PHP Upload Files

Source: Internet
Author: User

<title>PHP Upload Files</title> PHP Upload Files

sudo vi/etc/php.ini

File_uploads = Onupload_max_filesize = 100m  # The maximum allowable upload file size post_max_size = 100M        # refers to the maximum value that can be received by the form POST to PHP Max_exe Cution_time =    # maximum time value per PHP page run (seconds) memory_limit = 128M         # maximum memory eaten per PHP page
$name=$_files["MyFile"]["Name"];$type=$_files["MyFile"]["Type"];$size=$_files["MyFile"]["Size"];$Temp=$_files["MyFile"]["Tmp_name"];$Error=$_files["MyFile"]["Error"];if($Error> 0) { die("Error uploading file! Code$error.");}Else{if(Is_uploaded_file ($Temp)) {if(Move_uploaded_file ($Temp,"uploaded/".$name) ) {Echo "Upload complete!"; }Else{Print_r (Error_get_last ()); }    }Else{Echo "Upload_file error \ n"; }}

Permissions issues:

chmod O+w uploaded

After confirming that it is not the error, then it should be the SeLinux problem

sudo setenforce 0

Uploading the file should be successful.

PHP Upload Files

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.