Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

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
0
eldoz12
Asked:
eldoz12
  • 5
  • 3
  • 2
  • +1
1 Solution
 
ZvonkoSystems architectCommented:
As preview you can use a simple window.open.
Like this:

<input type="file" name="myFile" onChange="window.open(this.value,'_blank','height=200,width=400');">


0
 
DireOrbAntCommented:
You can't preview a client-side file in your page unless you use a signed applet/activex.
0
 
eldoz12Author Commented:
Can i do it without using java-script .....
plz advice
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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>

0
 
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
0
 
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.

0
 
braddini1433Commented:
you might be able to pop up the local file window.open("local path")
0
 
braddini1433Commented:
<html>
<head>
<title>Untitled Document</title>

</head>

<body>
<script language="javascript">
      function popupfile(obj)
            {
                  window.open(obj.value);
            
            
            }

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

</FORM>


</body>
</html>
0
 
ZvonkoSystems architectCommented:
braddini1433, tell me please the difference betwean your proposal and my first proposal one day before yours.

0
 
braddini1433Commented:
Not much to tell the truth the only different is that i split out the window.open 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.


 
0
 
ZvonkoSystems architectCommented:
No problem :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now