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, 4945👍, 0💬
Popular Posts:
Can you explain the fundamentals of “GetGlobalResourceObject ”and “GetLocalResourceObject” function...
What is the difference between RegisterClientScriptBloc kand RegisterStartupScript? RegisterClientSc...
What is Shell scripting A shell script is a script written for the shell, or command line interprete...
What are the five levels in CMMI? There are five levels of the CMM. According to the SEI, Level 1 – ...
How To Specify Two Background Images on a Page? - CSS Tutorials - Page Layout and Background Image D...