Home  >  Article  >  Backend Development  >  File upload without refresh, file upload with refresh_PHP tutorial

File upload without refresh, file upload with refresh_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:54:34911browse

No refresh file upload, refresh file upload

No refresh file upload

ajax’s FormData object completes no refresh operation

ajax level 2 standard can operate on files, but only supports new browsers (not compatible with lower versions of IE), and is an H5 standard

Notes:

b) css settings

c) Set up monitoring file upload events

  • To monitor ajax operations through onreadystatechange

  • Send an ajax request (Note: You do not need to set the ajax request header when using FormData to complete data upload)

  • Use the event source (uploaded file) in onprogress to display progress

  • The server data.php file implements uploaded file processing

    iframe implements refresh-free upload

  • Create an index.php file and set the upload domain

    Technical point 1: You need to set the window opened by form submission to an iframe defined by yourself

    Technical point 2: The generated image needs to be processed in the data.php file, and then the image URL address is returned. Use top to get the window to open the current iframe, and modify the src attribute of the img tag.

    2. data.php completes saving and returning images

  • www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1119776.htmlTechArticleNo refresh file upload, refresh file upload no refresh file upload ajax's FormData object completes no refresh operation ajax level 2 standard File operations can be performed, but only new browsers are supported...
    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn