note 29432 modified in features.file-upload.common-pitfalls by vrana

From: Date: Tue, 17 Aug 2004 13:55:42 +0000
Subject: note 29432 modified in features.file-upload.common-pitfalls by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79956@lists.php.net to get a copy of this message
In older versions of PHP (4.0, 4.1) when you doesn't receive a file you cannot determine exactly what has happend. Here is a part of code with results of my testing (Mozilla 0.9, Explorer 5, Opera 6) <?php if(empty($HTTP_POST_FILES["image"])) { echo ("No file given (Mozilla), file doesn't exist (Konqueror, Mozilla)"); } elseif(empty($HTTP_POST_FILES["image"]["name"]) ) { echo ("No file given (Konqueror, Explorer, Opera), file doesn't exist (Explorer)"); } elseif(empty($HTTP_POST_FILES["image"]["size"]) || $HTTP_POST_FILES["image"]["tmp_name"]=="none") { echo ("File is zero size or too big (or it doesn't exist (Opera))"); } ?> --was-- In older versions of PHP (4.0, 4.1) when you doesn't receive a file you cannot determine exactly what has happend. Here is a part of code with results of my testing (Mozilla 0.9, Explorer 5, Opera 6) if(empty($HTTP_POST_FILES["image"])) { echo ("No file given (Mozilla), file doesn't exist (Konqueror, Mozilla)"); } elseif(empty($HTTP_POST_FILES["image"]["name"]) ) { echo ("No file given (Konqueror, Explorer, Opera), file doesn't exist (Explorer)"); } elseif(empty($HTTP_POST_FILES["image"]["size"]) || $HTTP_POST_FILES["image"]["tmp_name"]=="none") { echo ("File is zero size or too big (or it doesn't exist (Opera))"); } http://php.net/manual/en/features.file-upload.common-pitfalls.php

« previous php.notes (#79956) next »