Php image file Upload instance code. Provide a simple and practical php picture file Upload instance code php Tutorial picture file Upload instance code htmlxmlnswww. bkjia. com1999xhtmlheadmetahttp-equivcontent-typecon provides a simple and practical php picture file Upload instance code
Php Tutorial image file Upload instance code
Php Tutorial image file Upload instance code
If ($ _ post)
{
If ($ _ files ['file'])
{
$ Filename = $ _ files ['file'] ['type'];
$ Newname require 'php100.com.gif ';
If (strtolower ($ filename) = 'image/GIF ')
{
If (move_uploaded_file ($ _ files ['file'] ['tmp _ name'], $ newname ))
{
// $ Ext = getimagesize ($ newname );
// Print_r ($ ext );
Echo 'image uploaded successfully ';
}
Else
{
Die ('image Upload failed! ');
}
}
Else
{
Exit ('The program only allows uploading GIF image ');
}
}
}
/*
Move_uploaded_file syntax reference address
Http://www.bkjia.com/phper/24/da78cda75379943ff126f6af13cf5aa9.htm
Strtolower instance address
Http://www.bkjia.com/phper/21/805cd7d41d20a10b71b35e1a8f2b8596.htm
$ _ Files
$ _ Files [''myfile'] [''Name''] original name of the client file.
$ _ Files [''myfile'] [''type''] mime type of the file. the file must be supported by the browser, for example, "image/gif ".
$ _ Files ['myfile'] ['size'] size of the uploaded file, in bytes.
$ _ Files ['myfile'] [''tmp _ name''] temporary file name stored on the server after the file is uploaded, which is generally the default file name. It can be specified in upload_tmp_dir of php. ini, but the putenv () function setting does not work.
$ _ Files [''myfile'] [''error''] error code related to the file upload. [''Error''] is added in php 4.2.0.
*/
?>
This site original tutorials reprinted to indicate the source of http://www.bkjia.com/phper/php.html
Upload php Tutorial image file Upload instance code html xmlns = http://www.bkjia.com/1999/xhtml head meta http-equiv = content-type con...