PHP image File Upload Instance Code _php tutorial

Source: Internet
Author: User
Provides a simple and practical php image file upload Instance code

PHP Tutorial picture File Upload Instance code




PHP Tutorial picture File Upload Instance code





if ($_post)
{
if ($_files[' file '])
{
$filename = $_files[' file ' [' type '];
$newname = ' 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 upload succeeded ';
}
Else
{
Die (' picture upload failed! ');
}
}
Else
{
Exit (' This program only allows GIF images to be uploaded ');
}
}
}


/*
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 said there was
$_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 '] file is uploaded and stored on the server after the temporary file name, 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 PHP 4.2. Version 0

*/
?>

This site original tutorial reproduced annotated source in http://www.bkjia.com/phper/php.html


http://www.bkjia.com/PHPjc/444913.html www.bkjia.com true http://www.bkjia.com/PHPjc/444913.html techarticle provide a simple and practical php image File Upload Instance code php tutorial picture 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.