Reputation: 14835
I have the following in an HTML form:
<input type="file" name="frontimage" id="frontimage" />
<input type="file" name="backimage" id="backimage" />
<input type="file" name="extraimage" id="extraimage" />
I need to access all three of these images and upload them via PHP. I know how to do this with ONE file, but not three. How do I access each one and upload it?
Right now I am using this code to upload just a single file:
move_uploaded_file($_FILES["file"]["tmp_name"], $path);
How do I do multiple at once? Note that I need to know which file is which, so an array of files won't work by just [0]
, [1]
, [2]
... I need to move each individually to a certain location.
Upvotes: 0
Views: 774
Reputation: 11717
move_uploaded_file($_FILES["frontimage"]["tmp_name"], $path);
move_uploaded_file($_FILES["backimage"]["tmp_name"], $path);
move_uploaded_file($_FILES["extraimage"]["tmp_name"], $path);
You can handle each file separately
Upvotes: 3