Uploading files
Posted: Wed Jul 03, 2002 6:15 am
I have been using this script for uploading files. Info is sent from a file field in a HTML form to a page where the upload_file() function is called.
This script was working perfectly on my old vertsion of PHP but now it is not working on version 4.2. I am aware of some of the differences in version 4.2 but none of the changes I have made work.
Can anyone tell me how to modify this script to work on PHP4.2?
Code: Select all
function upload_file()
{
$archive_dir="./temp";
global $userfile, $userfile_name, $archive_dir, $WINDIR;
if(isset($WINDIR)) $userfile = str_replace("\"e;, ""e;, $userfile);
$filename = basename($userfile_name);
if(!@copy($userfile, "$archive_dir/$filename"))
die("Can't copy $userfile_name to $filename.");
@unlink($userfile);
}Can anyone tell me how to modify this script to work on PHP4.2?