File Upload Results
set_time_limit(60);// make reasonably sure the script does not time out on large files
$path1 = AddSlashes("/tmp/"); // assign our path in a form PHP for Windows understands
for($i = 0; $i < 4; $i++){// loop through the 4 possible files
switch($i){// retrieve a file pointer from the temp directory
case 0:
$source = $file1;
$source_name = $file1_name;
break;
case 1:
$source = $file2;
$source_name = $file2_name;
break;
case 2:
$source = $file3;
$source_name = $file3_name;
break;
case 3:
$source = $file4;
$source_name = $file4_name;
break;
}
if(($source <> "none")&&($source <> "")){ // see if the file exists; non-existing file has name of "none"
if($error1 <> 1){// no need to copy a file if directory not write-enabled
$dest = $path1.$source_name; // append file name to our path
if(copy($source,$dest)){ // copy the file from the temp directory to the upload directory, and test for success
echo "$source_name has been uploaded
\n";
}
else {
echo "Upload directory not write-enabled\n"; // you need to write-enable the upload directory
$error1 = 1; // set flag
}
}
unlink($source);// delete the file from the temp directory
}
}
?>
Back
File Upload
If your browser is upload-enabled, you will see "Browse" (Netscape, Internet Explorer) or ". . ." (Opera) buttons below. Use them to select file(s) to upload, then click the "Upload" button. After the files have been uploaded, you will see a results screen.