Handle upload from file in disk

Hi,
I tried successfully to upload a .zip file (not a tar.gz... don't know why) to a blob field and retrieved it again correctly using the provided documentation. My problem is that I'm generating some text files that I zip into a file in disk on the server and I want to upload it automatically to a blob field.
What I've tried since now is:
This code uploads the file, but there is a problem when downloading from xataface application that makes the downloaded file unusable. I think the problem is with the method that I use to read the file or with the format I apply to $data before uploading the file.
Does anybody knows how to handle file upload to a blob from server disk?
Thanks in advance.
I tried successfully to upload a .zip file (not a tar.gz... don't know why) to a blob field and retrieved it again correctly using the provided documentation. My problem is that I'm generating some text files that I zip into a file in disk on the server and I want to upload it automatically to a blob field.
What I've tried since now is:
- Code: Select all
$data = file_get_contents("/tmp/tmp.zip");
$data = mysql_real_escape_string($data);
$record->setValues(
array(,
'FITXERS'=>$data,
'FITXERS_mimetype'=>"application/x-gzip",
'FITXERS_filename'=>"tmp.zip"
));
This code uploads the file, but there is a problem when downloading from xataface application that makes the downloaded file unusable. I think the problem is with the method that I use to read the file or with the format I apply to $data before uploading the file.
Does anybody knows how to handle file upload to a blob from server disk?
Thanks in advance.