PHP File Upload problems when uploading "larger" (over 2MB) files - php

I am having problems trying to upload "larger" files, and I believe the limit that I'm allowed is about 2MB. I've uploaded multiple filetypes below 2MB (.js, .png, .jpg, .psd, .php), however anything over about 2MB fails.
1.8MB psd image worked
2.4MB psd image didnt' work (same file as 1.8, just bigger)
I've already changed php.ini to the following:
upload_max_filesize = 20M (changed this from 2M)
post_max_size = 40M (changed this from 2M)
max_execution_time = 60 (changed this from 45)
max_input_time = 180 (changed this from 30)
memory_limit = 48M (Changed this from 8M)
I've also added the following to my htaccess file in both the final directory where I'd like the file to be moved, and the initial directory where the upload form lives:
LimitRequestBody 53687091
Like I mentioned, the upload is working for smaller files, so I believe it has to be a restriction on the upload size, not anything wrong with the form.
Any ideas as to where I can look next? I want the limit to be 20M, it's all on our backend with a login required to access the page, so I am not worried about rouge uploads.

Confirm that your upload_max_filesize / post_max_size is INDEED updated.
Sometimes users don't know which php.ini file to edit.
Best way is to create file (that you delete later) and add the following code:
<?php
phpinfo();
?>
Run that file to get your system settings (search for upload_max_filesize, etc);

Have you tried restarting your web server since making the changes?

Related

Upload filesize limit in CodeIgniter seems to be ignored

I am working on a CodeIgniter project that involves file uploads. When I try to upload a file 2.2MB (default upload size limit in CI is 2MB = 2048KB) it works with no problem. But when I try something bigger (21.5MB) it returns:
[msg] => You did not select a file to upload"
I changed the max_size parameter to both "0" and "204800" (200MB in KB), but still nothing works. You will say to check my php.ini file, but I already did and the max_upload_size directive is set to 200M, which also phpinfo() confirms.
So, please tell me, what am I doing wrong and which is the right way to do it?
If you are using POST to upload your files, you may also want to change your htaccess file.
php_value upload_max_filesize 2M

Try to upload .zip file using ftp_put function but it is not able to upload large file(more than 1 MB)

I am using the following code to upload a .zip file, but am unable to upload a file of size greater than 1MB:
$upload = ftp_put($conn_id, $target_path.'/'.$filename, $source, FTP_BINARY);
Any thoughts?
Have you changed the config settings at php.ini max_file_uploads to a latger value, the values are taken as MB so give something as large as 5
I am sure it should work.
changing in php.ini will result in php application that is running.
changing in htaccess file will result in project
changing in a php file will result in php file and its included files
Choosing which one is based on your recuirements.
Use, upload_max_filesize this will control the size of file to be uploaded.
post_max_size is the size of data posted in side form elements.
it could be file, input, checkbox... etc. So this also has to be altered based on file size.
You should adjust both upload_max_filesize and post_max_size to perform file operation and others...
Have you checked error_log . If not check that, and find out what exactly the problem is, and if using apache, you can set the php.ini setting in .htaccess . Like this
php_value upload_max_filesize 20M
Paste this .htaccess file and you will be able to upload the file. Also,check error_log for exactly what is causing the issue.

Large file uploads failing php

I've made a tiny site where my friends can upload songs and some tiny files that they want to but my problem is that files over 5mb fails, as in the browser shows "Connection reset" error.
The max file size set by my server is 2Mb, but i can upload 2.5-3Mb fine
Probably because i overwrote it with .htaccess
But however file uploads over 5Mb they just don't get uploaded at all, as i said earlier browser cannot reach server.
Would this be a server issue? Or an issue in my code? Will i need to change things in order for large uploads to happen?
Also max post size and max file size is set to 40mb in the .htaccess file
Here is the website
http://sharebay.webatu.com/
You can try uploading some files over 7mb, mp3/flac/aac/m4a/wav/
Add these to .htaccess as well (adjust 10M to size in MB that you want):
php_value upload_max_filesize 10M
php_value post_max_size 10M
This assumes you don't have access to php.ini (otherwise it would be better to put there) and that your host does not prohibit htaccess overrides on these values.
If you've already tried that then post more info about your environment. If you are on a shared server it's probably not something you can change too much.
How long the upload takes?
If you have slow upload line then it should take more time then max_execution_time and then apache halts your PHP script.
Change file upload size
You can change it an .htaccess file.
.htaccess files are stored in the same directory as your .php files are. They modify configuration for that folder and all sub-folders. You simply use them by creating an .htaccess file in the directory of your choice (or modify it if present).
The following should enable you to increase your upload limit (if the server provider allows PHP config changes via .htaccess).
php_value upload_max_filesize 70M
php_value post_max_size 80M
php_value memory_limit 90M
php_value max_execution_time 240
php_value max_input_time 240
you can change size according ur need

What is the MAXIMUM file upload size in PHP ini file

I have changed the upload_max_filesize to 150MB in the php.ini file.
but http://localhost/info.php shows the upload_max_filesize is still showing 16MB .
I have also restarted the server.
what is the the problem?
I am unable to find the solution.
Make sure that post_max_size is larger than your upload_max_filesize value.
This limits the overall size of the POST body, which also has a bearing on the max upload size.
You will also need to ensure that memory_limit is larger than post_max_size.
Also upload_max_filesize should be changed in both php.ini files..
In the Apache folder, and the PHP folder..
Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
Find this line in the php.ini file “upload_max_filesize = 2M” and replace it with a higher value (e.g. “upload_max_filesize = 64M”)
You may also want to increase your max post size. Look for this line in your php.ini file “post_max_size” and increase it as well.
Save the changes to the file inside your wp-admin directory.
Try the upload again
If you still have issues, look for this file in your root directory and make the same changes.
move your php folder insise your localhost directory, open php.ini
press control + f find upload_max_filesize change it from 2M to whatever you want, and also change post_max_size from 8M to again whatever u want,save changes , overwrite this php.ini file with file in php folder,restart your localhost and check it.

cannot change php upload size limit

I used uplaodify plugin to upload music files. Everyting is okay in my local
uploadify.php file is in public_html/uploadify directory
i want to increment my upload file size limit to 10 MB
i tried to put
php.ini file in public_html
post_max_size = 500M
upload_max_filesize = 500M
max_execution_time = 900;
max_input_time 900
and I am looking my phpinfo() thats good
but ı cannot upload bigger than 2MB
And i tried to put same php.ini in public_html/uploadify
Now I can upload file which size 2.5 MB , but no upper;
And
ini_set('upload_max_size','10M');
ini_set('post_max_size','10M');
ini_set('max_execution_time','900');
lines is in the my index.php and uploadify.php
What should I do increment my file upload size limit
EDIT
I look $_FILES[..]['error'], and its 7
UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
But I can upload file which smaller than 2.5 MB
Edit the .htaccess file in the root folder and add these values:
RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000
You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits.
You cannot override upload limits from within a script using ini_set - the upload will have completed (or been aborted) using the original settings long before PHP fires up and processes the ini_sets.
You can't just litter php.ini files around your system either - php doesn't load random .ini files it finds lying around. It only loads them from specific locations. If PHP hasn't been told to load one from the uploadify directory, you'll have to use a .htaccess and php_value directives.
Hello I had the similar issue while uploading a theme on wordpress on localhost. After hours of research I was able to put following 3 lines in my php.ini and restarted the apache and it worked. I thought this will help others.
This will go in file upload section of ini
upload_max_filesize = 800M
post_max_size = 800M
max_file_uploads = 800M

Categories