oe a
oe a

Reputation: 2280

Upload not saving large files

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.

Upvotes: 2

Views: 651

Answers (1)

Daryl Gill
Daryl Gill

Reputation: 5524

After editing your php.ini you must reload/restart your apache server to make all changes take place. Issue from Command line one of the following:

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

OR

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

Either one of the 4 will be be fine; preferably the restart option

Upvotes: 2

Related Questions