0

I want to upload files using an image as a button. The image is a square 150x150. When I click the square, the file dialog should open up. How do I do this?

1

4 Answers 4

1

File type inputs cannot be styled, but there is a workaround, see Quirks Mode documentation on this.

Basically you make the input completely transparent and position the image beneath.

Sign up to request clarification or add additional context in comments.

Comments

0

Have a look at A file input button for all browsers, is this possible? - this was using another button element but it could use an image instead.

Comments

0

This link may be usefull : http://www.filamentgroup.com/lab/jquery_custom_file_input_book_designing_with_progressive_enhancement/

It explain how to :

  1. Add a "backaground layer" with you own design fir the field.
  2. Change the style of "Basic File Button" to transparent et put it over the layer.

You can also find some "jQuery Plugin" to transforme all you form field :

  1. http://uniformjs.com/ -> Uniform

Hope is what you want.

Aka.

Comments

0

You can declare the input file and the image then , hide the "choose file" button BY PUTTING A DIV ON IT. The div should be the same as the background.

Then link the image to the button using jquery and use trigger

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.