Ajax-----11iframe Analog Ajax File Upload effect principle 3

Source: Internet
Author: User

If the user is prompted to upload the success, then if the user upload a larger file, then the half are not reflected, then the user is likely to refresh or close the never ...

So it will have a certain impact on our servers, so we can improve the user experience in this area, such as to do the same as we often see the progress bar

<!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); /*add an identity in an upload*/            $('#jindu'). HTML (''); //return false;        }    </Script></Head><Body>    <PID= "Mess"></P>    <PID= "Jindu"></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//simulate a relatively large file being uploaded    Sleep(3); if(Empty($_files)){        Exit(' No file '); }    $errs=$_files[' Pic '] [' error '] = = 0? ' Success ': ' Error '; Echo"<script> parent.document.getElementById (' Mess '). InnerHTML = '$errs' </script> '; //shut him down after the upload was successful .    Echo"<script> parent.document.getElementById (' Jindu '). style.display = ' None ' </script>";

The effect is as follows:

Ajax-----11iframe Analog Ajax File Upload effect principle 3

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.