Re: [PHP] Error checking on file upload

2005-08-19 Thread Steve Slotnick
In your php.ini there are settings for "upload_max_filesize" and also 
"post_max_size." These would be causes for case 2. More information: 
http://us3.php.net/features.file-upload


On 8/19/05, Peppy < [EMAIL PROTECTED]> wrote:
> 
> I've been working on a script for uploading a file to a Unix server. I'm 
> testing the script and have it coded for error messages using a switch 
> statement. One error that I am getting is case 2 "The file is bigger than 
> this form allows" and I am wondering what might cause me to get the error 
> for case 1 "The file is bigger than this PHP installation allows".
> 
> Thank you,
> Althea
> 
> 
> 
>  
> 
> 
> 
> Send this file:  
> 
> 
> 
> 
> -
> $uploaddir = 
> '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; 
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> 
> echo '';
> if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> echo "File is valid, and was successfully uploaded.\n"; 
> } else {
> echo "Possible file upload attack!\n";
> switch ($_FILES['userfile'] ['error'])
> { case 1:
> print ' The file is bigger than this PHP installation allows';
> break;
> case 2:
> print ' The file is bigger than this form allows';
> break;
> case 3:
> print ' Only part of the file was uploaded';
> break;
> case 4:
> print ' No file was uploaded';
> break;
> 
> }
> }
> 
> echo 'Here is some more debugging info:';
> print_r($_FILES);
> 
> echo "";
> 
> 
> 
>


Re: [PHP] Error checking on file upload

2005-08-19 Thread Steve Slotnick
Sorry, I meant case 1.

- Steve

On 8/19/05, Steve Slotnick <[EMAIL PROTECTED]> wrote:
> 
> In your php.ini there are settings for "upload_max_filesize" and also 
> "post_max_size." These would be causes for case 2. More information: 
> http://us3.php.net/features.file-upload
> 
> 
> On 8/19/05, Peppy < [EMAIL PROTECTED]> wrote:
> > 
> > I've been working on a script for uploading a file to a Unix server. I'm 
> > testing the script and have it coded for error messages using a switch 
> > statement. One error that I am getting is case 2 "The file is bigger than 
> > this form allows" and I am wondering what might cause me to get the error 
> > for case 1 "The file is bigger than this PHP installation allows".
> > 
> > Thank you,
> > Althea
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> > Send this file:  
> > 
> > 
> > 
> > 
> > -
> > $uploaddir = 
> > '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; 
> > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> > 
> > echo '';
> > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> > echo "File is valid, and was successfully uploaded.\n"; 
> > } else {
> > echo "Possible file upload attack!\n";
> > switch ($_FILES['userfile'] ['error'])
> > { case 1:
> > print ' The file is bigger than this PHP installation allows';
> > break;
> > case 2:
> > print ' The file is bigger than this form allows';
> > break;
> > case 3:
> > print ' Only part of the file was uploaded';
> > break;
> > case 4:
> > print ' No file was uploaded';
> > break;
> > 
> > }
> > }
> > 
> > echo 'Here is some more debugging info:';
> > print_r($_FILES);
> > 
> > echo "";
> > 
> > 
> > 
> > 
>