$_files["File" ["Name"]-the name of the file being uploaded
$_files["File" ["type"]-the type of file being uploaded
$_files["File" ["Size"]-the size of the uploaded file, measured in bytes
$_files["File" ["Tmp_name"]-the name of the temporary copy of the file stored on the server
$_files["File" ["Error"]-error code caused by file upload
PHP code
!--? php
If (($_files["File" ["type"] = = "Image/gif")
| | ($_files["File" ["type"] = = "Image/jpeg")
| | ($_files["File" ["type"] = = "Image/pjpeg"))
&& ($_files["File" ["Size"] < 20000))
{
if ($_files["file" ["error"] > 0)
{
echo "error:". $_files["File" ["Error"]. "
";
}
Else
{
echo "upload:". $_files["File" ["Name"]. "
";
echo "type:". $_files["File" ["type"]. "
";
echo "Size:". ($_files["File" ["Size"]/1024). "KB
";
echo "stored in:". $_files["File" ["Tmp_name"];
}
}
Else
{
echo "invalid file";
}
?
The contents of the $_files array are as follows:
$_files[' myfile ' [' Name '] The original name of the client file.
The MIME type of the $_files[' myfile ' [' type '] file requires the browser to provide support for that information, such as "Image/gif".
$_files[' myfile ' [' size '] the size of the uploaded file, in bytes.
$_files[' myfile ' [' tmp_name '] files are uploaded after the temporary file name stored on the server, usually the system default. Can be specified in the php.ini upload_tmp_dir, but the putenv () function setting is not working.
$_files[' myfile ' [' Error '] and the file upload related error code. [' ERROR '] was added in version php 4.2.0. Here is a description of it: (they become constants after php3.0)
Upload_err_ok
Value: 0; No error occurred and the file upload was successful.
Upload_err_ini_size
Value: 1; The uploaded file exceeds the value of the Upload_max_filesize option limit in php.ini.
Upload_err_form_size
Value: 2; The size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.
Upload_err_partial
Value: 3; Only part of the file is uploaded.
Upload_err_no_file
Value: 4; No files were uploaded.
Value: 5; The upload file size is 0.
http://www.bkjia.com/PHPjc/445362.html www.bkjia.com true http://www.bkjia.com/PHPjc/445362.html techarticle $_files[file][name]-the name of the uploaded file $_files[file][type]-the type of file being uploaded $_files[file][size]-the size of the uploaded file, in bytes $_files[file][tmp _name] ...