Hi,
I'm getting an error with this file upload. My form tag has that enctype="multipart/formdata" in it, and input type="file", yada yada yada... all been set up, but here's the code:
I have the pathname scrambled just for privacy's sake.
My idea was to try copying it to a temporary location (2nd line) but that doesn't work, and I get the error as early in the script as that.
Any help appreciated. Thanks. (This is my first PHP file upload)
I'm getting an error with this file upload. My form tag has that enctype="multipart/formdata" in it, and input type="file", yada yada yada... all been set up, but here's the code:
PHP:
//tmp location.
copy ($_FILES['file']['tmp_name'], $_FILES['file']['name']) or die ('Could not upload');
if ($file != "")
{
$file = $HTTP_POST_FILES['filename']['tmp_name'];
$file_name = $HTTP_POST_FILES['filename']['name'];
$file_size = $HTTP_POST_FILES['filename']['size'];
$file_type = $HTTP_POST_FILES['filename']['type'];
$file_error = $HTTP_POST_FILES['filename']['error'];
if ($file_error > 0)
{
echo "Problem: ";
switch ($file_error)
{
case 1: display_error('File is too big. Max size is 3 MB.'); break;
case 2: display_error('File is too big. Max size is 3 MB.'); break;
case 3: display_error('The file was only partially uploaded.'); break;
case 4: display_error('The file did not upload.'); break;
}
exit;
}
if ($file_type != "zip")
{
echo(' >>> '.$file_type.' <<< ');
display_error('That is not a valid file. File extention must be .zip.');
}
if ($file_size > $MAX_FILE_SIZE)
{
display_error('File is too large - maximum size allowed is 3 MB.');
}
//put the file where we want it.
$location = '/home/***/public_html/flonds/**/**/**/**/**/'.$file_name;
if (is_uploaded_file($filename))
{
if (!move_uploaded_file($filename, $upfile))
{
display_error('Could not move file to directory.');
}
}
else
{
display_error('Problem: Possible file upload attack. Filename: '.$file_name);
}
}
I have the pathname scrambled just for privacy's sake.
My idea was to try copying it to a temporary location (2nd line) but that doesn't work, and I get the error as early in the script as that.
Any help appreciated. Thanks. (This is my first PHP file upload)







