Skip to content
Advertisement

PHP How to update uploaded multiple file in different column in DB table

I have an HTML form to upload two PDF files. Am able to successfully make it upload one file to a column but not sure how to upload each PDF files to a different column on the database table. Below is my code:

JavaScript
JavaScript
“`

How can I get the name and PDF files of each input “file” and “files2” and submit to the different column on the database and Uploadfolder on the server? I have a query like this: UPDATE hobber_vendor SET vendor_blicense = :vendor_blicense AND vendor_btax = :vendor_btax WHERE vendor_id = ‘$send_id’ I want to update vendor_btax to store the name of files from “files2″ and also upload the file to move_uploaded_file($temp,$UploadFolder.”/”.$vendor_btax); array_push($uploadedFiles, $vendor_tax);

Advertisement

Answer

So after all research, troubleshooting, and following every line of my code. Was able to resolve this by firstly changing my HTML code to below:

JavaScript

Then I got value for each input and assign it to each column on the database. Also, I declared the uniqid() outside my foreach loop to reuse in case users try to upload files that have the same path name as the one on the server. Below is my complete PHP code:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement