what is the max size or limit of file upload control when used in php?

Alex

New member
my code is as follows

<html>
<body>

<form action="fileupload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

<?php
if ($_FILES["file"] != "")
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
move_uploaded_file($_FILES["file"]
["tmp_name"],
"uploads/".$_FILES["file"]["name"]);

}
}
?>

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.
 
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).
 
Back
Top