Posted by Jeff on 01/18/07 11:07
Hey
The code below gives this error message when I submit a file:
Warning: filesize() [function.filesize]: stat failed for
C:\WINDOWS\TEMP\php3D.tmp in C:\Inetpub\wwwroot\demo\pic.php on line 18
What am I doing wrong here? is it because the parameter to filesize() is
actually a temp file?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
if (!empty($_FILES["userfile"])) {
$instr = fopen($_FILES['userfile']['tmp_name'], "rb");
$file = $_FILES['userfile']['tmp_name'];
echo filesize($file);
}
?>
<form enctype="multipart/form-data" action="pic.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
</body>
</html>
Navigation:
[Reply to this message]
|