【发布时间】:2014-04-03 11:48:04
【问题描述】:
这是(几乎)完美的工作,有些文件已上传,有些则没有(尤其是大文件)。任何想法 ?我以为ini_set('post_max_size', '1024M'); 和ini_set('upload_max_filesize', '1024M'); 可以解决大小问题,但它不能正常工作。
<?php
ini_set('post_max_size', '1024M');
ini_set('upload_max_filesize', '1024M');
if (isset($_FILES["myfile"])) {
if ($_FILES["myfile"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "<br>";
} else {
$target_path = "uploads/";
if(!file_exists($target_path)){mkdir($target_path);}
move_uploaded_file($_FILES["myfile"]["tmp_name"], $target_path.$_FILES["myfile"]["name"]);
echo "<pre>";
print_r($_POST);
print_r($_FILES);
}
}
?><!doctype html>
<head></head>
<body>
<form action="/" method="post" enctype="multipart/form-data">
<input type="file" name="myfile">
<input type="submit" value="Upload">
</form>
</body>
</html>
【问题讨论】:
-
您收到什么错误?上传是可写的吗?
标签: php forms post upload uploading