Sign in to follow this  
SteveDeFacto

[web] I want to be able to upload images like Ebay does but how?

Recommended Posts

When you create a new listing on ebay an upload window pops up, you select the file using standard file type input and submit the form. Some how the upload page tells the main window which opened the upload window to now display the image then closes the upload window. I got a window to pop up and display a form which has a file type input and a submit button, when the user hits the submit button it submits the form to upload.php but what code should be in this file to tell it to update the main window and close?

Share this post


Link to post
Share on other sites
Hello SteveDeFacto,

assuming you are using PHP or ASP.Net for this you could do this with Ajax.

http://en.wikipedia.org/wiki/Ajax_%28programming%29

Maybe you should tell a little bit more about you programm/page. Maybe there is a way to use some redirects or reload a page.

http://en.wikipedia.org/wiki/Wikipedia:Redirect

-GWDev

Share this post


Link to post
Share on other sites
Quote:
Original post by SteveDeFacto
When you create a new listing on ebay an upload window pops up, you select the file using standard file type input and submit the form. Some how the upload page tells the main window which opened the upload window to now display the image then closes the upload window.

I got a window to pop up and display a form which has a file type input and a submit button, when the user hits the submit button it submits the form to upload.php but what code should be in this file to tell it to update the main window and close?


Your upload handler returns a little HTML containining JS which does the aformentioned things.
Something like

<script>
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
window.close();
</script>


[Edited by - Konfusius on March 9, 2010 1:23:46 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Konfusius
Quote:
Original post by SteveDeFacto
When you create a new listing on ebay an upload window pops up, you select the file using standard file type input and submit the form. Some how the upload page tells the main window which opened the upload window to now display the image then closes the upload window.

I got a window to pop up and display a form which has a file type input and a submit button, when the user hits the submit button it submits the form to upload.php but what code should be in this file to tell it to update the main window and close?


Your upload handler returns a little HTML containining javascript which does the aformentioned things.
Something like

<script>
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
window.close();
</script>


Thank you so much, thats exactly what I wanted!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this