Reputation: 763
I am developing this website where users can browse for a file, more specifically a .csv
file on their computer (clientside). I then want to send the contents of this .csv
file to my server. Once serverside, it will be stored into my database.
But firstly, I need to get the path of the .csv
file. So i assume i should allow the user to browse for the file from their computer. Then when the user has chose a file, the path will be stored into a variable such that i can proceed on to store the contents to my database.
I therefore have 3 questions:
Code snippets and references will be appreciated.
Upvotes: 0
Views: 3193
Reputation: 5416
"path will be stored into a variable such that I can proceed on to store the contents to my database" - No, that's not how it works.
You're not storing a path. You're actually allowing the user to specify the path to the file in the browser. However, when the form is submitted, the actual contents of the file are read and posted to your server in the form post along with the rest of the form fields.
You can read the file server-side and continue to parse it in PHP and store it in the database etc.
Upvotes: 1
Reputation: 106077
There's a section in the manual dedicated to this topic. It should have all the information you need.
Upvotes: 0