Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-12-2006, 10:01 PM   PM User | #1
fuzzy1
Regular Coder

 
Join Date: Apr 2006
Posts: 311
Thanks: 17
Thanked 0 Times in 0 Posts
fuzzy1 is an unknown quantity at this point
Write/Move/Save pdf to MySQL Table?

Is upload the only way to pass a file to a table?

I have a contract.pdf which is generated via php (FPDF) and saved in a temporary file. I need that file then moved /written to the appropriate customer table in our database (MySQL ) so that the temporary file may then be overwritten by the next Customer/Order.

While I am able to upload the file via <input type="file" name="uploadpdf> and related uploader.php, asking our web-users to “browse” for the file does not suit our needs, and of course adding a default value
<input type="file" name="uploadpdf" value="http://localhost/crm/modules/Orders/contract.pdf"> doesn’t work either.

As the file is always the same (modules/Orders/contract.pdf) how may I manage that move automatically, (say with a ‘Confirm Order’ button) to the database?

Last edited by fuzzy1; 07-12-2006 at 10:06 PM.. Reason: Oops
fuzzy1 is offline   Reply With Quote
Old 07-13-2006, 10:07 AM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
your post doesn't make a lott of sense to me.

what you normally do is store the file in some directory, and then you only store the path to the file inside your db.
if you then want to show all the files that were generated for that user, then you just run a select on your table, and you display a link to each file (using the path from the db inside the link-tag).
so when you create the pdf on your server, you give it some unique name, like username_date_time.pdf, and then you store the path in your db. if you only want to keep 1 file for each user, then just always name the file like username.pdf.
if you upload the file from the users local, then you rename the file and move it from the temporarely directory to wherevere you want to store the files, and then again store the path in your db.
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 07-14-2006, 06:21 PM   PM User | #3
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
Please see this article about BLOBS.

http://www.devarticles.com/c/a/MySQL/MySQL-and-BLOBs/

I've done this in Oracle without much trouble, and MySQL is usually easier.
arnyinc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:59 AM.


Advertisement
Log in to turn off these ads.