Re: File upload problem
| From: | Mi5ha | Date: | Thu, 05 Jun 2003 09:20:11 +0000 |
| Subject: | Re: File upload problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150319@lists.php.net to get a copy of this message | ||
If you don't want users to write empty files to your server, why don't you
just stop them ? You can write something like this:
if ($HTTP_POST_FILES['file1']['size']!=0){
move_uploaded_file($HTTP_POST_FILES['file1']['tmp_name'],
$upload_dir.$HTTP_POST_FILES['file1']['name']);
}
else {
echo "WARNING: File is zero size !!!<br>";
}
Mi5ha
--
Please enter your access password: penis
ERROR: Sorry your password is not long enough...
"Sami Kollanus" <kolli@cc.jyu.fi> wrote in message
news:20030605074137.94505.qmail@pb1.pair.com...
> I'm using:
> - Apache 2.0.40 server (linux)
> - PHP 4.2.2
>
> I use file uploads in my code, but there occured small problems with the
> server update(from Apache 1.3.??, PHP 4.1.2). is_uploaded_file()- and
> move_uploaded_file()-functions don't work correctly any more. Or
> actually the file upload system doesn't work correctly.
>
> The problem is to recognice, when the user try to upload a file, which
> doesn't exist. It's possible to even write nonsense like "sdafasdf" into
> the file type input-field (Mozzilla and IE). In that case the current
> server writes an empty file named according to the text "sdafasdf".
>
> When there is a legal empty file "uploaded" to the server,
> is_uploaded_file() doesn't fail. So, there is no way to recognice, when
> the user try upload a "nonsense-file".
>
> Can anybody help? I don't know, if it's PHP or Apache causing the
> problem. Is there any settings, which could cause this?
>