Php file Upload entry-level code

Source: Internet
Author: User
Tags file upload php file upload php tutorial

This is a new handwritten Upload File. After some problems are solved, the file can be uploaded completely and any type is supported.

<Form action = "form. php Tutorial" method = "post" enctype = "multipart/form-data">
<Input type = "hidden" name = "MAX_FILE_SIZE" value = "100000000">
<Input type = "file" name = "spic"> <br>
<Input type = "submit" name = "sub" value = "upload file"> <br>
       
<? Php
If (is_uploaded_file ($ _ FILES ['spic '] ['tmp _ name']) {
Echo "<pre> ";
Print_r ($ _ FILES );
Move_uploaded_file ($ _ FILES ['spic '] ['tmp _ name'], $ _ FILES ['spic'] ['name']);
Echo "uploaded successfully ";
               
Echo "</pre> ";
                }
?>
</Form>

    
During the running process, you can find a file as follows:

Array
(
[Spic] => Array
        (
[Name] => IMG_0044.JPG
[Type] => image/jpeg
[Tmp_name] => F: TempphpF695.tmp
[Error] => 0
[Size] = & gt; 3737804
        )

)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.