We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2010-04-15
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?

Watch Question
Software Developer
Top Expert 2006
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE