Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Detect File Uploading Errors
How To Detect File Uploading Errors? - PHP Script Tips - Uploading Files to Web Servers
✍: FYIcenter.com
If there was a problem for a file upload request specified by the <INPUT TYPE=FILE NAME=fieldName...> tag, an error code will be available in $_FILES[$fieldName]['error']. Possible error code values are:
Based on the error codes, you can have a better logic to process uploaded files more accurately, as shown in the following script:
<?php
$file = '\fyicenter\images\fyicenter.logo';
$error = $_FILES['fyicenter_logo']['error'];
$tmp_name = $_FILES['fyicenter_logo']['tmp_name'];
print("<pre>\n");
if ($error==UPLOAD_ERR_OK) {
move_uploaded_file($tmp_name, $file);
print("File uploaded.\n");
} else if ($error==UPLOAD_ERR_NO_FILE) {
print("No files specified.\n");
} else {
print("Upload faield.\n");
}
print("</pre>\n");
?>
If you try this script with logo_upload.php and do not specify any files, you will get the "No files specified." message.
2007-04-19, 5262👍, 0💬
Popular Posts:
Which bit wise operator is suitable for turning off a particular bit in a number? The bitwise AND op...
Can a variable be both const and volatile? Yes. The const modifier means that this code cannot chang...
What are some uses of Intranets & Extranets? An "intranet" is the generic term for a collect...
How To Process Query Result in PL/SQL? - Oracle DBA FAQ - Introduction to PL/SQL You can run queries...
Write out a function that prints out all the permutations of a string. For example, abc would give y...