preview of file before file upload

hello experts ,
I would want to give users a preview of the File which they are going to upload in pop window before they submit the request .
The file could be a pdf ,doc,xls file ,
Is there anyway i can do it with java script if not please suggest the best to do it ,
application a j2ee

thank you
Who is Participating?
ZvonkoConnect With a Mentor Systems architectCommented:
As preview you can use a simple
Like this:

<input type="file" name="myFile" onChange=",'_blank','height=200,width=400');">

You can't preview a client-side file in your page unless you use a signed applet/activex.
eldoz12Author Commented:
Can i do it without using java-script .....
plz advice
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

ZvonkoSystems architectCommented:
Come on.
User selects a local file. Press a button and see in a new window what he has selected, right? And that all without script? OK, but then you have to wait for new browsers with the built in feature <doWhatImean>

eldoz12Author Commented:
The problem is the file being uploaded can be a pdf ,xls,doc file how can i show the preview for such file formates ...i think i need to send it back to the server and some how come up with a way to show the perview
ZvonkoSystems architectCommented:
Being uploaded, preview and upload and view does not feet under one hat. And it has noting to do with this Topic Area. Perhaps it is better you ask for move of this question to your server side scripting language TA, like ASP, PHP, Perl or what you use.

you might be able to pop up the local file"local path")
<title>Untitled Document</title>


<script language="javascript">
      function popupfile(obj)

      <INPUT type="file" onChange="popupfile(this)">


ZvonkoSystems architectCommented:
braddini1433, tell me please the difference betwean your proposal and my first proposal one day before yours.

Not much to tell the truth the only different is that i split out the into a funtion.

I saw the topic and had code for this on a web site i did for someone a wile back . didnt even bother reading the comments my bad ,Im sorry if i posted in haste
kind of got post happy.

ZvonkoSystems architectCommented:
No problem :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.