Download file as image

I was wondering how I am going to make an input to upload a file as an image.

For example, Facebook and Twitter have image icons for uploading image files.

Thank,

Brian

+5
source share
3 answers

Script example

The "input" has the style: display:none;than simple:

$('#upload_img').click(function(){
    $('#upload').click();
});
+6
source

Quite recent browsers allow you to call click()in an element <input type="file">during the click event for another element, such as an image. (If you did not wait for the click event, you will probably receive a warning about blocking pop-ups.)

+2
source

goto HTML-only, , , :

http://www.quirksmode.org/dom/inputfile.html

basically, you place the image somewhere and you overlay <input type="file" />with the transparency set to 0.

It works in browsers as old as css opacity filters. Alternatives include flash and a call .click()on the input element.

0
source

All Articles