my code is as follows
%26lt;html%26gt;
%26lt;body%26gt;
%26lt;form action=%26quot;fileupload.php%26quot; method=%26quot;post%26quot;
enctype=%26quot;multipart/form-data%26quot;%26gt;
%26lt;label for=%26quot;file%26quot;%26gt;Filename:%26lt;/label%26gt;
%26lt;input type=%26quot;file%26quot; name=%26quot;file%26quot; id=%26quot;file%26quot; /%26gt;
%26lt;input type=%26quot;submit%26quot; name=%26quot;submit%26quot; value=%26quot;Submit%26quot; /%26gt;
%26lt;/form%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;
%26lt;?php
if ($_FILES[%26quot;file%26quot;] != %26quot;%26quot;)
{
if ($_FILES[%26quot;file%26quot;][%26quot;error%26quot;] %26gt; 0)
{
echo %26quot;Error: %26quot; . $_FILES[%26quot;file%26quot;][%26quot;error%26quot;] . %26quot;
%26quot;;
}
else
{
echo %26quot;Upload: %26quot; . $_FILES[%26quot;file%26quot;][%26quot;name%26quot;] . %26quot;
%26quot;;
echo %26quot;Type: %26quot; . $_FILES[%26quot;file%26quot;][%26quot;type%26quot;] . %26quot;
%26quot;;
echo %26quot;Size: %26quot; . ($_FILES[%26quot;file%26quot;][%26quot;size%26quot;] / 1024) . %26quot; Kb
%26quot;;
echo %26quot;Stored in: %26quot; . $_FILES[%26quot;file%26quot;][%26quot;tmp_name%26quot;];
move_uploaded_file($_FILES[%26quot;file%26quot;]
[%26quot;tmp_name%26quot;],
%26quot;uploads/%26quot;.$_FILES[%26quot;file%26quot;][%26quot;name%26quot;]);
}
}
?%26gt;
when i tried to upload 10MB file size, it was not uploaded and no error is shown, so what is the max file size or limit of a file upload control,can we change the max size.
What is the max size or limit of file upload control when used in php?
The size is limited in php.ini file by setting variables
'upload_max_filesize' and 'post_max_size' to a desired value.
Unfortunatelly on shared server this affects all users and host providers won't change it.
If you have a dedicaded server , under your control, just set values you want.
If you want to see current settings, create a file:
info.php with content:
%26lt;html%26gt;%26lt;body%26gt;
%26lt;?php
print phpinfo();
?%26gt;
%26lt;/body%26gt;%26lt;/html%26gt;
and execute it
What is the max size or limit of file upload control when used in php?
The limit varies depending on how PHP has been configured on that server (in PHP.ini)
The max upload size should be displayed somewhere in the output of phpinfo()
Sometimes you can change PHP settings using .htaccess, but I think this is something that only the server administrator can do.
It could also be something to do with max execution times and timeouts. Scripts have to finish executing within a certain time or they are terminated, and so if your upload is taking a long time it may not finish within this limit (which also varies based on the PHP config).