我正在创建一个上传文件页面,我希望用户上传csv或zip文件。下面的代码只处理小文件(大约10-30kb!),但是在php.ini文件中它表示资源限制超过128m而 upload_max_filesize 是64m。这是迄今为止的代码:
<?php
$target_path = "theTargetPath";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
它不会上传任何超过10-30kb的.csv或文件,我们将非常感谢您提供正确方向的任何帮助或帮助。
答案 0 :(得分:1)
以下是我接下来要尝试的内容:
在php.ini文件中,查找要设置的值:
upload_max_filesize = 64M
post_max_size = 64M
将以下内容添加到.htaccess文件中:
php_value upload_max_filesize 64M
php_value post_max_size 64M