PHP to achieve a simple picture upload

Source: Internet
Author: User
File upload. LINUX+APACHE+PHP3/4 test passed. IIS test failed, win+apache+php not tested
<?php
if ($HTTP _post_vars["upload"]== "upload") {
file://Here you can add check file name, format, picture size and so on function,
file://$picurl The full path of the local system
file://$picurl _name The temporary file name after uploading
file://$picurl _size File Size (in bytes)
MIME type of file://$picurl _type file

Copy ("$picurl", "/where/you/want/put/the/uploaded/files/in/$picurl _name");
Exit
}
?>
<form action= "." Method= "POST" enctype= "Multipart/form-data" name= "UL" >
<!--Note: Here must be added ' enctype= ' multipart/form-data ', otherwise it will not produce on
Movement-->
<input type= "File" Name= "Picurl" size= "15"
accept= "Image/x-png,image/gif,image/jpeg" >
<input type= "Submit" name= "Upload" value= "upload" >
</form>

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.