Click here to Skip to main content
15,877,051 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:

I want to show preview of selected image as it is selected using file upload control.
I tried ajaxfileuploader and Ajax call but as my file upload control is in .ascx file(user control) it is not working for me.
I am not able to get whole path of selected file at client side directly and I don't want to refresh page on selection of file (to get path).

Please help me. I am badly stucked in this problem.

Thanks in Advance..
Updated 21-May-11 1:40am

1 solution

The fact you're in an ascx is irrelevant. You'd need to post details of what 'not working' means. There's no reason for a control to upload immediately, although I can see how an AJAX one, would do that. Access to the details of the file upload control is limited, for security reasons, but if you can read the value in there, you can write your own javascript code to show the image by reading it from the client ( that being the only place it exists at that time ).

I see you added some detail.

I doubt it's possible to get the full path on the client side. And with some browsers, you can't even get the full client side path on the server. Are you testing on more than one browser ? I suspect to do what you want, needs a control hosted in the page.

I googled and confirmed, you can't do it.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900