This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Ajax popup file selector and image preview Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Ajax popup file selector and image preview" Watch "Ajax popup file selector and image preview" New topic
Author

Ajax popup file selector and image preview

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
HI

Wondering if anyone can help, I need to create a image selector with previews using Javascript (AJAX even).

Basically I need a link on the main page (A) which opens a popup window (B), which contains the file selector (<input type=file />) and a 'submit' button.
When you hit submit, the popup disappears and a preview of the selected image appears on page A within a <div> tag I'm guessing.

So far I have this:



And a simple popup.html



At the point of clicking 'submit' I'm hoping to get a preview of the image in div 'img1' tag.

I had this as a sample a while back but have a new PC now and lost it.

Thanks in adavnce for any help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56209
    
  13

Once the file is uploaded, you must create an <img> tag the references it by server URL.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Ajax popup file selector and image preview
 
Similar Threads
JSP not calling JS file funtion
problem when integrating jspell with tinyMCE editor
Form "action" issue / javascript question
Is there something better then event.pageX/Y?
preview of an image for uploading in firefox