Files / Blobs and Downloading [SOLVED]

Talk about Image/File fields (uploading, problems etc.)

Moderator: alexandrleonenko

helenemele
Expert
Expert
Posts: 53
Joined: Mar 16th, '10, 19:44

Files / Blobs and Downloading [SOLVED]

Postby helenemele » Mar 18th, '10, 15:55

First, let me thank you since this grid has saved me countless hours/days and expertise required to get my site up and running...love it! Also excuse me for being a bit of a noob on the DG but I am learning fast, I think, lol.

Here is my issue and would be happy if I could figure out either option below.

Option (1) Currently my website allows a user to upload a file...for example a residential lease on a house (i.e. lease.doc or lease.pdf). I am currently using an html form to upload the file (not the DG) for the user into mysql (blob). Everything appears to be working fine on the upload, but who knows. Is there a way for the DG in edit or view mode to display or allow a link to this field(blob) in mysql in such a way that the user can click on it or download it and have it be the correct file type/name for them to open it. In other words, I cant figure out how to get the darn thing out of mysql and work through the DG.

Option (2) I could scrap my user custom form for storing the file in mysql and use the DG Add new record function and make the "lease" field be a file. I have played around with this and I can see my file uploaded successfully to my server in my upload directory. However, 2 things are causing me a stumbling block here. First, I would need a unique name everytime a file is uploaded...maybe I could concatenate date/userid/lease.doc as a file name? Secondly, and most irritating, is again, I cant figure out how to get the file open from the user side of things. I have read all the threads in this section and I cant get the file to open on edit mode (i.e. pull up in pdf format). The field in the DG has an [upload] next to it anda [clear] that appear to work fine. How do you get a [dowload] or [open] link?

Thank you in advance!
Last edited by helenemele on Apr 19th, '12, 15:08, edited 1 time in total.

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Files / Blobs and Downloading

Postby administrator » Mar 21st, '10, 09:34

In new version 6.0.7 of DataGrid (already released) there is a new attribute for field/image fields: "allow_downloading"=>"false"
when you turn it "On" you may download the uploaded file.

helenemele
Expert
Expert
Posts: 53
Joined: Mar 16th, '10, 19:44

Re: Files / Blobs and Downloading

Postby helenemele » Mar 24th, '10, 18:30

Thank you....I am upgrading today :)

helenemele
Expert
Expert
Posts: 53
Joined: Mar 16th, '10, 19:44

Re: Files / Blobs and Downloading

Postby helenemele » Mar 25th, '11, 15:16

We had experimented with this a year ago and ended up holding off since we did not want to store our documents as files on our servers. This has become more of a pressing need to our clients lately so we must re-visit.

What we would like to do is store our files as blobs in MySQL, that is, not store them as files on our servers. With the volume of docs and their size, we believe MySql will do a much better job. Btw, I have just upgraded to the latest DG 6.41. I am looking through the filetypes in Add/Edit mode with the latest release and I see two options?:

(1) we could store the docs as a file but this option puts the docs on our servers, not to mention having to deal with dup file names, etc. This is not a good choice for us.

(2) When I choose BLOB, I get the equivalent of a text box in Add/Edit mode to type into...no file upload/download options?

Is there a way in the DG to store files directly into MySQL and retrieve them out easily through the DG as well? It seems like what I am looking for is an option to get it to work like it does with the type "file" except it ultimately puts it into a MySQL blob column for storage in the database....and retrieval out, of course too.

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Files / Blobs and Downloading

Postby administrator » Mar 27th, '11, 11:58

No, such option doesn't exist - you need to create your own type of field, that allows to upload file and store it like BLOB


Return to “Field type: "image/file"”