drayarms Posted April 12, 2012 Share Posted April 12, 2012 I'm trying to upload pictures in a modal dialog window. So I got this idea to submit the form that processes the upload into a hidden iframe within the dialog window. That works, fine(the pictures get uploaded), but I can't figure out how to send back feedback info from the iframe to the modal window. I tried to echo some error/success variables into the dialog window from the processing form. Instead what happens is when the upload process is done, a fresh window of the page holding the dialog box opens, the old page with the still open dialog box remains static. So what seems to be happening is the data is being sent from the iframe to the parent of the dialog, not the dialog itself. Anyone knows how I can accomplish what I want? All the threads I've seen so far only deal with transferring data from iframe to parent window, none specifically deals with a parent dialog window. Now here is the code I'm dealing with. the dialog window is a div with id "pic_dialog" It contains the form, the iframe and the feedback div <div id = "pic_dialog"> <form enctype="multipart/form-data" action="picture_upload.php" target = "picture_upload_iframe" method="post"> <div> Upload A Picture </div> <input name="MAX_FILE_SIZE" value="10000000" type="hidden"> <input name="picture" accept="image/jpg, image/png, image/jpeg, image/bmp, image/gif, video/*" type="file"> <button class = "button" name="submit" type="submit"> Submit! </button> </form> <iframe name="pic_upload_iframe" src="" style="visibility:hidden;"></iframe> <div id="pic_upload_feedback"> </div> </div> <!--closes pic dialog> Then at the end of the picture_upload.php script which handles the form, after checking if the picture has uploaded successfully, I include this line to send the feedback. The session variables are the error/succees variables <?php //...A whole lotta ommitted code print "<script type='text/javascript'> $('#pic_upload_feedback', window.parent.document).html(<div>".$_SESSION['error'].$_SESSION['pic_upload_success']."</div> ); </script>"; ?> Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/260785-how-does-one-pass-data-from-an-iframe-to-its-parent-dialog-window/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.