zardiw Posted January 7, 2008 Share Posted January 7, 2008 Quick and easy way to upload a file without reloading your webpage. How To upload a file asynchronous method. <FORM ID="FrmDlyUpload" target="FrmDlyIFrame" enctype="multipart/form-data" method="post" action="AmandaUpload.php"> <P align="center"><B>Upload Daily EOD File</B></P> <P align="center"> <INPUT type="file" ID="FrmDlyFile" name="FrmDlyFile" size="60"> </P> <P align="center"> <INPUT type="Submit" name="FrmDlyBtn" value="Upload Daily"> </P> <P align="center"><B>Status: <IFRAME id="FrmDlyIFrame" name="FrmDlyIFrame" style="width:300px;height:25px;border:2px solid #ffffff;"></IFRAME> </B></P> </FORM> PHP File Code (From AmandaUpload.php): // Upload Daily File $target_path = "/XXXXXXX/lXXX/XXXX/XXXXX/XXXXX/PHP/"; $UpdFileNm = basename($_FILES['FrmDlyFile']['name']); $target_path = $target_path . $UpdFileNm; if (move_uploaded_file($_FILES['FrmDlyFile']['tmp_name'], $target_path)) { $returnData = 'EOD File Uploaded'; } else{ switch ($_FILES['FrmDlyFile'] ['error']) { case 1: $returnData = 'File exceeds PHP'; break; case 2: $returnData = 'File exceeds form'; break; case 3: $returnData = 'Partial Upload'; break; case 4: $returnData = 'No file was uploaded'; break; } } print ($returnData . ': ' . $UpdFileNm); ?> Link to comment https://forums.phpfreaks.com/topic/84829-file-upload-using-iframe-and-xml-workaround-without-ajax-code/ Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 Are you simply presenting a code or asking for help? If you're just presenting a code, I suggest you read the forum title; otherwise, ask a question. Link to comment https://forums.phpfreaks.com/topic/84829-file-upload-using-iframe-and-xml-workaround-without-ajax-code/#findComment-432588 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.