Php image file Upload instance code _ PHP Tutorial

Source: Internet
Author: User
Tags upload php
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.