FileUpload control.

E

Eric

I'm using the fileuploadcontrol for the user to select a file, in this case
a image file.
I would like to see the little preview image to be shown right after
selection, but there seems to be no event from the fileupload control.
To by-pass this I let the user click on a linkbutton to show the preview,
but when the page comes back after the postback, the fileuploadcontrol is
empty again.

Is there an update to this control, giving more events?
Is there a third party control, better then the one shipped with vs2005?
Is there a way to create these events for the fileuploadcontrol?

rg,
Eric
 
I

intrader

I'm using the fileuploadcontrol for the user to select a file, in this case
a image file.
I would like to see the little preview image to be shown right after
selection, but there seems to be no event from the fileupload control.
To by-pass this I let the user click on a linkbutton to show the preview,
but when the page comes back after the postback, the fileuploadcontrol is
empty again.

Is there an update to this control, giving more events?
Is there a third party control, better then the one shipped with vs2005?
Is there a way to create these events for the fileuploadcontrol?

rg,
Eric
Once the file is at the server, you can have the server render an
image to the client in thumbnail size width/height.
 
R

ray.bradbury9

First of all, excuse my poor english.

I don't think that is possible, let me explain why. Through Javascript
you cannot access the local filesystem, perhaps setting the IE security
to lowest, but I don't think it could work. As intrader has noticed,
that can be accomplished once the file is in the web server, it is the
best way.

The following code does NOT work.

<script type="text/javascript" language="javascript">
function cargarImagenServer(){
Imagen.src=fileUploader1.value;
}
</script>
<img id="Imagen" alt="Imagen A mostrar" src="" />
<asp:FileUpload runat="server" onclick="cargarImagenServer();"
ID="fileUploader1" />
 
Joined
Aug 4, 2009
Messages
1
Reaction score
0
This works for me:

HTML:
<script type="text/javascript">
     function previewImg(path, img) {
          imgPrev = document.images[img];
          imgPrev.src = path;
     }
</script>
HTML:
<asp:FileUpload runat="server" ID="uploadImage"  onchange="previewImg(this.value, 'imgPreview');" />
<br />
<asp:Image ID="imgPreview" name="imgPreviewModify" runat="server" />
 
Joined
Nov 3, 2009
Messages
1
Reaction score
0
Not Working

Hello,

It's not working with me can anyone plz help...
The src of the image is changing but the page isnt refreshing so that the image can load again with the other src...

Thank you,

Anthony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top