Click here to Skip to main content
15,895,370 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to use image for file upload. In many website I saw that on image click instead of the Browse file upload.
I tried to do so but unable to do so

Any Help
Thanks in advance.

Suraj Prakash
Posted
Comments
OriginalGriff 21-Jan-11 14:55pm    
Please do not use the "Add an Answer" button to reply to people. Use the "Add Comment" feature at the bottom of each answer instead.

If you add an answer, nobody is alerted. If you add a comment, the person you are commenting to is emailed. This may mean you get a quicker response - otherwise you will have to wait until they "drop by" and check their answers. This could be some considerable time, or never.
I have converted you answer to a comment, and deleted your answer.

on image click instead of the Browse file upload
Here is the trick. Keep a File-upload control on the page but set it's display property as hidden. Now, on image click, via client side invoke the file-upload browse button. (If you want you can dynamically create the control and invoke). This way, on click of image, the browse file popup would come and one can select it.
 
Share this answer
 
Are you trying to upload and image with out file upload control? If so, that is not possible. How can you specify the file on the client? Even if you can set the file you want to upload, that would be huge security hole. Imagine some website try to load file from your machine with out your knowledge.

You need file upload in order to upload a file.
 
Share this answer
 
Comments
OriginalGriff 21-Jan-11 14:53pm    
The OP Wrote:
"These days website like gmail use these features. When we compose New email then for attachment we click on link button. After Clicking on link button file upload windows opens. I want to use this feature...

Can You help me..
Thanks"
Yusuf 21-Jan-11 15:15pm    
May be the OP deleted his post. I don't see it anywhere. I see you indicated that he should add comment not push "answer". Oh well....

Yes Gmail uses Ajax to do file upload. It is very sleek.
OriginalGriff 21-Jan-11 15:19pm    
No, I moved his answer to a comment, and deleted the answer.
Yusuf 21-Jan-11 15:23pm    
Aha! I see...
hi this is very interested ans thanks for help me
 
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