Need help uploading files
Posted: Mon Oct 30, 2006 10:31 am
feyd | Please use
The file that I'm trying to load is 11.7MB. When I browse and select the file and click on Submit, I get the message Form not submitted. Any idea why?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am under a very tight deadline and I'm trying to get my upload_files class working. I'm trying to test this piece by piece. Brief synopsis:
The Upload_Files Class will validate the file extension (only certain file extensions can be uploaded), validate the file size (files larger than 25 MB are not allowed), and validate the user (banned users can not upload files). The code to check the file extension works. The code to validate the file size appears to be working but this is where I am having my problem. The code to prevent banned users from uploading is working. To test the size code, I put in a MAX_FILE_SIZE of 1MB and then tried to upload a file larger than 1MB. I set the MAX_FILE_SIZE hidden variable in the form and the variable that is passed in my code. I did not change the php.ini file which is set as the following:
; Maximum allowed size for uploaded files.
upload_max_filesize = 30M
The code to test the file size using 1MB as a MAX_FILE_SIZE worked fine. Now that I've changed it to be a max of 25MB, it doesn't work and I don't know why. Here is the pertinent code:Code: Select all
<?php
$result="";
if (isset($_POST['Submit']))
{
$result="Form Submitted.";
}
else
{
$result = "Form not submitted.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function createstatuswindow(){
w = window.open('Upload.html','_blank','height=150,width=250');
}
</script>
</head>
<body>
<p>List of projects go here</p>
<form action="test.php" method="post" enctype="multipart/form-data" name="test" id="test">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="26214400" />
<input name="fname" type="file" id="fname" size="100" maxlength="255" />
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" />
</p>
</form>
<p><?php echo $result ?></p>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]