Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Thanked 0 Times in 0 Posts

    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 11:06 PM. Reason: Oops

  2. #2
    Master Coder
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts
    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

  3. #3
    Regular Coder
    Join Date
    Jan 2003
    Thanked 8 Times in 8 Posts
    Please see this article about BLOBS.


    I've done this in Oracle without much trouble, and MySQL is usually easier.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts