isaac_cm Posted August 10, 2007 Share Posted August 10, 2007 Hello I have two pages one is main page the second is a file upload popup window I need to pass data when the upload is complete to the main page. thanks Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 10, 2007 Share Posted August 10, 2007 Here's how I would do it. The pop-up presumably contains a form which goes to another page when the upload is done. E.g., <form action='somewhere.php' method='POST'> <input type='file' name='fileUpload'/> <input type='submit' value='Upload!' /> </form> So in 'somewhere.php': <?php // Process the file upload here, then... echo "<script type='text/javascript'>window.onload = function() { window.opener.myVariable = myData; window.close();}</script>"; ?> This should set the variable myVariable in the parent window to the value in myData. Then it closes the upload window. Hope that helps. Quote Link to comment Share on other sites More sharing options...
isaac_cm Posted August 10, 2007 Author Share Posted August 10, 2007 I know about opener is there any other ways Thanks Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 10, 2007 Share Posted August 10, 2007 I don't think there are any other ways, as JS is the only way to deal with the client side DOM (except maybe VBScript or client side ASP). But you definitely can't in HTML or PHP. If your worried about client browsers that don't support JS, check out this thread: http://www.phpfreaks.com/forums/index.php/topic,154030.0.html. Check if your client has JS. If not, just do the upload script in the main window. Quote Link to comment Share on other sites More sharing options...
isaac_cm Posted August 10, 2007 Author Share Posted August 10, 2007 thanks by the way I use dreamweaver I need to know if there plug-in or tool is able to debug JS and PHP Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 10, 2007 Share Posted August 10, 2007 I have never used DreamWeaver. But for JS debugging I use FireFox's Error console. It typically gives at least the line number of an JS errors. For PHP debugging, I just use echo statements all over the place to figure out what's in the variables, etc. Sorry, I pretty much do my coding in a straight text editor! Quote Link to comment Share on other sites More sharing options...
isaac_cm Posted August 10, 2007 Author Share Posted August 10, 2007 this very painful when making big web app , I am checking now some tools for this reason specially among them is komodo IDE http://www.activestate.com/Products/komodo_ide/feature_list.plex Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 10, 2007 Share Posted August 10, 2007 Sorry, I only use free editors. Quote Link to comment 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.