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