PHP5: file upload: is_uploaded_file == false
am 08.01.2008 16:09:44 von r_ahimsa_mHello,
I need to implement file upload on .php page. To do so I have written in
Paper.php:
ValidateEdition();">
onblur="PassFile();" />
value="Cancel" />
(onblur is used because of bug.)
The file AddEdition.php is:
session_start();
require 'Scripts.inc';
if ($_SERVER['REQUEST_METHOD'] == 'POST' &&
isset($_POST['EditionFile']) && isset($_POST['Year']) &&
isset($_POST['Month']))
{
if (is_uploaded_file($_FILES['SelectEditionFile']['tmp_name']))
{
$file = $_FILES['SelectEditionFile']['name'];
$ext = @substr($file,
@strrpos($file, '.') ? @strrpos($file, '.') + 1 : @strlen($file),
@strlen($file));
$paper = 'Paper/Blask_' . $_POST['Year'] . '-' . $_POST['Month'] . '.' .
$ext;
@unlink($paper);
if (!move_uploaded_file($_FILES['SelectEditionFile']['tmp_name' ], $paper))
{
$_SESSION['Error'] = 'Failed to move the file.';
}
}
else
{
$_SESSION['Error'] = 'Failed to upload file.';
}
}
header("Location: Paper.php?topic=Editions");
?>
The problem is that is_uploaded_file(...) returns false (I have verified).
I don't understand why. Please help.
/RAM/