Ajax-----10iframe Analog Ajax File upload effect principle 2

Source: Internet
Author: User

In the actual development in fact, we can give users some hints, such as upload success or upload failure, nonsense said, walk code:

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Document</title>    <Scriptsrc= "Jq183.js"></Script>    <Script>        functionAjaxup () {varifname= ' up'+Math.random (); $("<iframe name= '"+ifname+"' height= ' 0 ' width= ' 0 ' frameborder= ' 0 ' ></iframe>"). AppendTo ($ ('Body')); $('Form:first'). attr ('Target', ifname); //return false;        }    </Script></Head><Body>    <PID= "Mess"></P>    <formAction= "9.php"Method= "POST"enctype= "Multipart/form-data"onsubmit= "return Ajaxup ();">        <inputtype= "File"name= "Pic"> <BR> <BR>        <inputtype= "Submit"value= "GO">    </form>    <iframesrc=""frameborder= "0"></iframe></Body></HTML>

<? PHP     if (empty($_files)) {        exit(' No file ');    }     $errs $_files [' Pic '] [' error '] = = 0? ' Success ': ' Error ';     Echo "<script> parent.document.getElementById (' Mess '). InnerHTML = '$errs' </script>";

Ajax-----10iframe Analog Ajax File upload effect principle 2

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.