Reputation:
I want to make a php upload script that takes two files through form
Form
image of form - https://i.sstatic.net/Q1Ivc.png
and then upload these two files in different folders like upload file1 to folder1 and file2 to folder2.
Can any body help ?
Upvotes: 1
Views: 2699
Reputation: 4620
Try this
<form action="multiple_upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="ufile[]" type="file" id="ufile[]" size="50" />
<input name="ufile[]" type="file" id="ufile[]" size="50" />
Php Code
$path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0];
$path2= "sample/".$HTTP_POST_FILES['ufile']['name'][1];
//copy file to where you want to store file
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
Upvotes: 0
Reputation: 4775
Your lack of effort disturbs me.
Check out this you'll then be able to move your file wherever you like (providing you have the correct permissions
Upvotes: 0
Reputation: 568
Create a form with two file fields. Get the fields in PHP and then save the files.
Take a look at:
http://php.net/manual/en/features.file-upload.php
Upvotes: 0