• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

image preview

 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


By using this i will get a browse box and a browse button . the moment i browse the image , i will get the path in the browse box.

what i want is the moment the path comes in the area then automatically the preview of the image should come in the specified area or there itself. how can i do it. i 've got few scripts in net but they are of no use. i am using firefox.

i want to see the preview of the image before i upload it to the database.

-thank you
 
ramnna jain
Ranch Hand
Posts: 129
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you , but its not working. it is giving a blank box.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sasank manohar wrote:Thank you , but its not working. it is giving a blank box.

It would be helpful is you were to post what the src is being set to.
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
off the bat ... try this;



Also, in above code, did you ensure that you're getting the "file" when you click on it? because on the snippet provided to you above I see that file path is non-relative ...

Trilochan
 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all i apologize for my very late response , what can i do , life is like that...hectic.

thank you ramnna and trilochan for your inputs.

i am trying to upload images from

C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\winter.jpg

but next time it can be D:\wallpapers\xyz.jpg or gif
so how can i give path, because image loading will be done by the user/client , so path is not in our hands.

the following code , tried individually didnot work.


also this as i already told you didn't work, its just giving blank box with specified sizes.


the html is ,




any help would be appreciated.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that JavaScript has access to the contents of a file upload field for security reasons, so this may not be possible.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is impossible to do it with today's browser security settings. If you want to do a preview you need to use Flash or an Applet OR upload it to a temp section on your server.

Eric
 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you ulf and eric.

is it possible with ajax ? I heard that it is possible with ajax, so how much is it true ?please tell me.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax == JavaScript == Nope
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic