A php no refresh upload file program code _php Tutorial

Source: Internet
Author: User
To implement a non-flush file upload we have a false image of the practice is to use the IFRAME framework for file upload, the other is the use of AJAX implementation of file upload, both methods can be achieved without refreshing file upload function.

One of the most primitive and simplest examples of IFRAME uploads:

Front desk upload page index.html, mainly a form with a JS callback function. When uploading a file, the method, Enctype property of the form form must be the same as the following code. Then set the value of target to the name of the IFRAME, so that no flush upload file can be implemented.

The code is as follows Copy Code





Uploading files






Background upload processing page uploadfile.php, this code for simple upload code, no error and exception handling. After the upload code execution, to tell the parent page has been uploaded, so, in this page called the parent page callback function callbackfunction, this function can have parameters, form their own definition.

The code is as follows Copy Code

Set_time_limit (0);
if ($_server[' Request_method ']== ' POST ') {
Move_uploaded_file ($_files["Test_file" ["Tmp_name"],
DirName ($_server[' script_filename '). " /uploadtemp/". $_files["Test_file" ["name"]);
echo "";
}
?>

The above is the use of an IFRAME to implement a non-flush upload file simple method, want a robust program needs to be refined

http://www.bkjia.com/PHPjc/629900.html www.bkjia.com true http://www.bkjia.com/PHPjc/629900.html techarticle to implement a non-flush file upload we have a false image of the practice is to use the IFRAME framework for file upload, the other is the use of AJAX implementation of file upload, both methods can be achieved ...

  • 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.