2

I am trying to create an upload form but it wont save large files and doesn't give any errors either.

I don't know where exactly the limit is but a 65kb image saves fine, whereas a 4mb image does not. The uploads folder is simply empty for larger files. I can verify it's uploading and see the request sent...however the server uploads folder remains empty.

Here is my upload script:

<?php
$ds = DIRECTORY_SEPARATOR; 
$storeFolder = 'uploads';  
if (!empty($_FILES)) { 
    $tempFile = $_FILES['file']['tmp_name'];               
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  
    $targetFile =  $targetPath. $_FILES['file']['name'];  
    move_uploaded_file($tempFile,$targetFile);    
}
?>   

And here are the relevant settings I have in my php.ini:

max_input_time = -1
memory_limit = 1500M
post_max_size = 1500M
file_uploads = On
upload_max_filesize = 1500M
max_file_uploads = 100
allow_url_fopen = On

This is for internal use only if you're wondering about the odd settings. As far as my actual upload page, it's just a simple html snipped from W3 schools.

This is running on Apache on an Ubuntu server. The script seems to work fine in a Windows WAMP setup. Also, the permissions on the directory are correct.

4

1 回答 1

2

编辑完 php.ini 后,您必须重新加载/重新启动 apache 服务器以进行所有更改。从以下命令行之一发出:

/etc/init.d/apache2 restart 
service apache2 restart

或者

/etc/init.d/apache2 reload
service apache2 reload

4个中的任何一个都可以;最好是重启选项

于 2013-04-26T02:38:18.630 回答