照《PHP与MySQL程序设计(第3版)》那本书(15.2.5 一个简单的示例,252页),写了一段利用表单上传文件的简单代码,如下:<form action="uploadmanager.php" enctype="multipart/form-data" method="post">
Last Name:<br /> <input type="text" name="name" value="" /><br />
Class Notes:<br /><input type="file" name="classnotes" value="" /><br />
<p><input type="submit" name="submit" value="Submit Notes" /></p>
</form><?php
/* Set a constant */
define ("FILEREPOSITORY", "c:/Temp/");
/* Make sure that the file was POSTed */
if (is_uploaded_file($_FILES['classnotes']['tmp_name'])) {
/* Was the file a PDF? */
if($_FILES['classnotes']['type'] != "application/pdf") {
echo "<p>Class notes must be uploaded in PDF format.</p>";
} else {
/* move uploaded file to final destination */
$name = $_POST['name'];
$result = move_uploaded_file($_FILES['classnotes']['tmp_name'],
FILEREPOSITORY."/$name.pdf");
if ($result == 1) echo "<p>File successfully uploaded.</p>";
else echo "<p>There was a problem uploading the file.</p>";
} #endIF
} #endIF
?>在表单里填入姓名和文件,点击按钮提交,结果弹出提示窗口:
php-cgi.exe - 应用程序错误,
-0x00f2fac0指令引用的"0x68676972"内存,该内存不能为"read"。
要终止程序,请单击“确定”。
要调试程序,请单击“取消”。点击“确定”后,网页上显示:
FastCGI Error
The FastCGI Handler was unable to process the request.
--------------------------------------------------------------------------------Error Details:•The FastCGI process exited unexpectedly
•Error Number: -1073741819 (0xc0000005).
•Error Description: Unknown Error
HTTP Error 500 - Server Error.
Internet Information Services (IIS)我用的环境是IIS5 + FastCGI + PHP5.3,浏览器是ie8,PHP.ini中关于文件上传的设置是:
file_uploads = On
max_execution_time =300
memory_limit = 128M
upload_max_filesize = 2M
upload_tmp_dir="C:\WINDOWS\Temp"
post_max_size = 8M
max_file_uploads = 20请问是什么原因导致出错,怎么解决?
Last Name:<br /> <input type="text" name="name" value="" /><br />
Class Notes:<br /><input type="file" name="classnotes" value="" /><br />
<p><input type="submit" name="submit" value="Submit Notes" /></p>
</form><?php
/* Set a constant */
define ("FILEREPOSITORY", "c:/Temp/");
/* Make sure that the file was POSTed */
if (is_uploaded_file($_FILES['classnotes']['tmp_name'])) {
/* Was the file a PDF? */
if($_FILES['classnotes']['type'] != "application/pdf") {
echo "<p>Class notes must be uploaded in PDF format.</p>";
} else {
/* move uploaded file to final destination */
$name = $_POST['name'];
$result = move_uploaded_file($_FILES['classnotes']['tmp_name'],
FILEREPOSITORY."/$name.pdf");
if ($result == 1) echo "<p>File successfully uploaded.</p>";
else echo "<p>There was a problem uploading the file.</p>";
} #endIF
} #endIF
?>在表单里填入姓名和文件,点击按钮提交,结果弹出提示窗口:
php-cgi.exe - 应用程序错误,
-0x00f2fac0指令引用的"0x68676972"内存,该内存不能为"read"。
要终止程序,请单击“确定”。
要调试程序,请单击“取消”。点击“确定”后,网页上显示:
FastCGI Error
The FastCGI Handler was unable to process the request.
--------------------------------------------------------------------------------Error Details:•The FastCGI process exited unexpectedly
•Error Number: -1073741819 (0xc0000005).
•Error Description: Unknown Error
HTTP Error 500 - Server Error.
Internet Information Services (IIS)我用的环境是IIS5 + FastCGI + PHP5.3,浏览器是ie8,PHP.ini中关于文件上传的设置是:
file_uploads = On
max_execution_time =300
memory_limit = 128M
upload_max_filesize = 2M
upload_tmp_dir="C:\WINDOWS\Temp"
post_max_size = 8M
max_file_uploads = 20请问是什么原因导致出错,怎么解决?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货