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, 5238👍, 0💬
Popular Posts:
When does the compiler not implicitly generate the address of the first element of an array? Wheneve...
Can you explain project life cycle ? Figure :- 12.2 Life cycle of a project There are five stages of...
How To Create an Add-to-Bloglines Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News...
How can JavaScript make a Web site easier to use? That is, are there certain JavaScript techniques t...
How To Select Some Rows from a Table? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY If yo...