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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Thanked 0 Times in 0 Posts

    Form data with Multiple File Upload


    I need help on saving form data to server sql database with multiple file attachments with some basic form validation.
    File attachments should be saved in the server in a specific folder, and the attachements name and the other form data should be stored in the sql data base. I am not sure where to start on this . your help is greatly appreciated...

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    You can use an HTML file input with a name ending in [] and it'll create an array of $_FILES for you to work with. Iterate that array, check and validate the uploaded files as necessary, and generate a random name for them. Verify that the random name is not yet in use, and use that name as a part of the filepath in the dbms to store with the other data input in the form.
    See here for more information on uploads: http://www.php.net/manual/en/feature...ost-method.php
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


Tags for this Thread

Posting Permissions

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