This topic is locked

Uploading / Storing Files in Database

6/19/2009 2:36:07 PM
PHPRunner General questions
M
mrphp author

Hello,
I have a database that I have setup to be able to upload files that are scanned invoices in PDF format. I enter the record of a purchase in the database and attached the PDF invoice. I've set it up to save the file in a directory. I have a couple questions:

  1. If I happen to save the PDF using a name I have used in the past, the existing PDF in the directory gets replaced without my knowing it. There is no prompt to overwrite so I loose the previous document. So, is there a way to force it to prompt me to overwrite if a PDF document by the same name already exists in the file directory?
  2. Is there a way to automatically create a name for the uploaded PDF, possibly using the recort ID, so I don't need to be concerned with what name I use for the PDF's but that would always be unique?
  3. Better yet, is it possible to save the PDF in the database itself as can be done with images? However, when viewing a record I don't want the document to display, just a link to click on to display it.
    Thanks for any help.

Admin 6/19/2009

PDF documents can be saved in the database exactly the same way as images.
To prevent overwriting you can use add a timestamp to uploaded file name. You can also use events to rename upload files:

http://www.xlinesoft.com/phprunner/docs/in...loaded_file.htm

M
mrphp author 6/22/2009

PDF documents can be saved in the database exactly the same way as images.

To prevent overwriting you can use add a timestamp to uploaded file name. You can also use events to rename upload files:

http://www.xlinesoft.com/phprunner/docs/in...loaded_file.htm


Somehow I missed the timestamp feature. This will do what I need since I'm not having any luck saving a PDF as part of a database.
Thanks for your help.

M
mrphp author 6/22/2009

PDF documents can be saved in the database exactly the same way as images.

To prevent overwriting you can use add a timestamp to uploaded file name. You can also use events to rename upload files:

http://www.xlinesoft.com/phprunner/docs/in...loaded_file.htm


Is there a "Live Demo" for saving documents in the database? When I try to set this up I set the "View As" page to "Image" and on the "Edit As" page the option is "File/Image" but it wants the location of an upload folder. This is when using PHPrunner 5.0. When I tried 5.1 all the options are grayed out.
Thanks.

J
Jane 6/24/2009