Download file from BLOB field

Archived from the Xataface Users forum.

transcan — Fri Jul 23, 2010 7:08 am

When uploading a file (word, pdf, xls, etc.), it appears to work. When checking the field, mysql displays gobbledygook. However, when trying to download by clicking on “View Field Content in New Window”, a new tab is opened in the browser showing only a blank page. No prompts to save the file, or the file is not automatically opened such as a pdf.

I’ve added:

Code: Select all
[binary] Type = blob widget:type = file

Another thread mentioned adding mime provisioning, or editing the blob.php file. Another one mentioned adding code to handling file names for the file uploaded.

What are the proper steps to allow for saving and then retrieving a file of any kind when using the BLOB/upload/download feature?

Thanks in advance.


jvinolas — Sun Aug 01, 2010 3:12 am

I also noticed that an update pf ‘PDFOutline’ field lets the user choose new file, but image is not updated even the PDFOutline_mimetype and PDFOutline_filename are updated correctly.

Has it something to do with cache?


shannah — Wed Aug 11, 2010 9:58 am

You may need to just hit refresh in the browser because it will be loading the image from the identical URL - so your browser probably still has the old one cached.

-Steve


cookie720 — Wed Jun 13, 2012 11:02 pm

Clicking to “View Field Content In New Window ()” Doesnt work, I tried refreshing too.
Can save the file from phpmyadmin but does not display in my details view, and not in the list either.


cookie720 — Mon Jun 18, 2012 1:02 am

Still trying all different kinds of ways, sadly nothing is working. Cannot even see one pixel of image
Please help XF gurus!


PolderBoy — Mon Jun 18, 2012 7:52 am

Hello,

I solved it by not using a blob field. The uploaded file adres is saved in the database.
part of the tablename.ini file:

[File_VL]
Type = container
widget:type = file
allowed_extensions = wav
savepath = /home/administrator/www/tables/tablename/VL
url = /tables/tablename/VL

Not the answer you were looking for, I know.


cookie720 — Mon Jun 18, 2012 8:25 am

So the container is just a varchar which stores the url, how do we set this up in mysql?
I want to have one photo per client.

  • I deleted all files from my client table folder and it is working, my images (BLOB) are appearing. As soon as I put my client.php delegateclass file back in, the image dissapears……..

PolderBoy — Tue Jun 19, 2012 12:31 am

Hello,

There are two ways you can do this.
One is to save the image as a blob in the database. (makes the database bigger)
The other is a more simple way and that is to save the file adres as a varchar in the table and upload the files (images) in a folder.

But you say:

  • I deleted all files from my client table folder and it is working, my images (BLOB) are appearing. As soon as I put my client.php delegateclass file back in, the image dissapears……..

That means that there is a error in your class.
Could you show the client.file?

Brian