.: Fuller Fresh Upload Form :.
Multiple Files Upload.
//set where you want to store files
//in this example we keep file in folder upload
//$_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path1= "upload/".$_FILES['ufile']['name'][0];
$path2= "upload/".$_FILES['ufile']['name'][1];
//copy file to where you want to store file
copy($_FILES['ufile']['tmp_name'][0], $path1);
copy($_FILES['ufile']['tmp_name'][1], $path2);
//$_FILES['ufile']['name'] = file name
//$_FILES['ufile']['size'] = file size
//$_FILES['ufile']['type'] = type of file
echo "File Name :".$_FILES['ufile']['name'][0]."
";
echo "File Size :".$_FILES['ufile']['size'][0]."
";
echo "File Type :".$_FILES['ufile']['type'][0]."
";
echo "
";
echo "File Name :".$_FILES['ufile']['name'][1]."
";
echo "File Size :".$_FILES['ufile']['size'][1]."
";
echo "File Type :".$_FILES['ufile']['type'][1]."
";
echo "
";
///////////////////////////////////////////////////////
// Use this code to display the error or success.
$filesize1=$_FILES['ufile']['size'][0];
$filesize2=$_FILES['ufile']['size'][1];
if($filesize1 && $filesize2 != 0)
{
echo "We have recieved your files";
}
else {
echo "ERROR.....";
}
//////////////////////////////////////////////
// What files that have a problem? (if found)
if($filesize1==0) {
echo "There're something error in your first file";
echo "
";
}
if($filesize2==0) {
echo "There're something error in your second file";
echo "
";
}
?>
Re: Php Auto Upload?
Posted 17 June 2009 - 09:05 PM
You can't make a script using PHP to pull files automatically off a visitors computer. If that is what you are trying to do. This is because 1) A security violation and 2) PHP is a server-side language so it has no knowledge of files on the client side.
Now you could use javascript to fill in the boxes when they first visit the page and then automatically submit the page for upload. But as far as PHP is concerned, you can't.
You can ask in the javascript forum for the javascript client side solution. Keep in mind that you will have to get the reference to the form AFTER it has been loaded up. So you may need to use a simple setTimeout() method call to kick off the form submit.
Copyright © 2011 - All Rights Reserved - Softron.in
Template by Softron Technology