hi everyone i am uploading multiple files with different names,so sometimes i want to upload a single
file within that form how do i handle that with php script.Can someone help me with php script that will allow you to upload name or picture ,or sometimes upload both at the same time using these form.

<form action="file-upload.php" method="post" enctype="multipart/form-data">
  Send these files:<br />
  <input name="name[]" type="file" /><br />
  <input name="pictures[]" type="file" /><br />
  <input type="submit" value="Send files" />
</form> 

php script
<?php
   $target = $_POST['path'];
   $fileone = $_FILES['name']['name'];
   $filetwo = $_FILES['picture']['name'];
    $Tdate = date('dFY');
   $path= "/home/myfiles/".$Tdate."/".basename($_FILES['upload']['name']) ;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'],$destfile))
		{
                  
			echo "copied succesfully to ".$destfile."<br/>";
		}
	        else
		{
			echo "failed to copy<br/>";
		}
?>

Recommended Answers

All 2 Replies

This script is correct somehow..but do you mean random names to each of the files??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.