Avatar of cabrera48
cabrera48 asked on

Unable to upload certain files, $_FILES['file_name']['error'] = 1 "The uploaded file exceeds the upload_max_filesize directive in php.ini"

I have the following form:

<form name="upload_temp" id="upload_temp" action="index.php?action=upload_temp" method="post" enctype="multipart/form-data">
            <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
            <input type="file" name="upload_file" id="upload_file" src="images/btn_browse.gif" border="0">

And in my php.ini file I set huge values for the following parameter:

max_execution_time = 320     ; Maximum execution time of each script, in seconds
max_input_time = 320    ; Maximum amount of time each script may spend parsing request data
memory_limit = 3000M      ; Maximum amount of memory a script may consume

; Maximum size of POST data that PHP will accept.
post_max_size = 3000M

; Maximum allowed size for uploaded files.
upload_max_filesize = 300M

So the upload works for some files, but failing to complete the upload for some others. When I print the $_FILES['upload_file']['error'] for the files that fail to upload, I get error message  code 1: "UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini."

But as you can see, my php.ini is set to have good enough values to handle the file. I do notice though that the files that fail to upload are the ones that are size bigger than  around 1900KB, how can I troubleshoot what is failing? Could it possibly be I don't have enough physical memory in my server to handle the upload files past a certain size? Shouldn't the server then be using virtual memory automatically as long as I set this to be a big size on php.ini?



                              
PHPWeb ApplicationsApache Web Server

Avatar of undefined
Last Comment
funamentalist

8/22/2022 - Mon
asian_niceguy

try changing the max_file_size hidden value to 300000000 (extra two zeroes)
ASKER CERTIFIED SOLUTION
Robin Hickmott

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
funamentalist

post_max_size is generally set to 8mb but "upload_max_filesize" is set to 2mb

So if the files are less than 8mb but greater than 2mb you would get that error , so increase the one you think suits your condition. Also as the above user said set_time_limit is also important but in your situation thats not the case.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy