RE: [PHP-WIN] File Upload Error: Boundary Length Exceeds Limit
| From: | Asendorf, John | Date: | Mon, 04 Dec 2000 19:28:58 +0000 |
| Subject: | RE: [PHP-WIN] File Upload Error: Boundary Length Exceeds Limit | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-4285@lists.php.net to get a copy of this message | ||
Dear Ryan,
Here is some code that I have used on IIS with NT... I'm not too sure by
what you have posted what it is exactly that you are doing wrong. I think
we'd need more code to help determine your problem. I've taken a renaming
scheme out of this so if something's missing, I'm sorry.
Play with the following and see if it helps....
/************************************
******* MAIN IF - upload file *******
*************************************/
if (isset($result)) {
if ($password !== "you could have a password here") {
echo "wrong password";
}
else{
// if the file is too big, don't accept it (100K)
if ( $result_size > 100000 ) {
echo "The file, $result_name ($result_size bytes), is too big.
Please contact $webmaster if you would like info on how to get that file
size smaller.";
}
// if $result_name isn't empty, try to copy the file
elseif ( eregi ("[a-zA-Z0-9_-]*.txt" , $result_name )) {
// copy the file to a directory or
//die and print an error message
// NOTE! if you're on a Windows machine,
// use Windows pathnames, like so:
// copy("$img1", "C:\\some\\directory\\path\\$img1_name");
copy("$result", "D:\\InetPub\\apath\\$result_name")
or die("Couldn't copy the file!");
?>
<P> </P>
<H2>SUCCESS!</H2>
<P> </P>
<P><B>You sent:</B> <? echo "$result_name"; ?>, a <? echo
"$result_size"; ?>
byte file with a mime type of <? echo "$result_type"; ?>.</p>
<?PHP
}
else {
// if $result_name was empty, die and let us know why
echo "No input file specified for results, or file is not a .txt
file.";
}
}
}
/* ***********************************
*** MAIN ELSE - form to enter file***
************************************ */
else { ?>
<form enctype="multipart/form-data" method="post"
action="result_uploader.php">
<P><strong>File to Upload:</strong><P>
<P>Password: <input type="password" name="password"
size="30"></p>
<P>File: <input type="file" name="result"
size="30"></p>
<P> </P>
<P><input type="submit" name="submit" value="Upload
Results"></p>
<?PHP
}
?>
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur.
> -----Original Message-----
> From: Ryan Jameson [mailto:ryan@ryanjameson.com]
> Sent: Friday, December 01, 2000 2:18 PM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] File Upload Error: Boundary Length Exceeds Limit
>
>
> I'm trying to get File Uploads to work in IIS. My form stuff
> looks like
> this:
>
> <form name="form1" ENCTYPE="multipart/form-data" method="post"
> action="handler.phtml">
> Upload:<input type="hidden" name="MAX_FILE_SIZE"
> value="500000">
> <input type="file" name="uploadfile">
> <input type="submit"></form>
>
>
> inside handler.phtml I have this:
> <?PHP
> echo $uploadfile_name," ",$uploadfile;
> ?>
>
> Using PHP4 I get no results and no errors but in PHP3 I get
> an error that
> says:
> File Upload Error: Boundary Length Exceeds Limit
>
> The file I selected to upload is only 6k.
>
> Any help is appreciated!
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>