Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html/CSS Upload File

Tags:

html

css

this is upload file code:

<form>
<input type="file" name="file"/>
</form>

It's appear a text box and BROWSE button to upload a file.

Well, But is there any way to upload a file by just click on "some" text, Example: "Upload your file" text. After click on this text then upload box will appear.

like image 819
Shibbir Avatar asked Nov 13 '22 06:11

Shibbir


1 Answers

Try this

http://jsfiddle.net/RffbE/

<form>
<input type="file" name="file" id="file" style="display:none"/>
<span onclick="doTrick()">Upload your file</span>
</form>

and use this javascript function.

function doTrick() {
    document.getElementById('file').click();
}
like image 65
Nauphal Avatar answered Dec 23 '22 06:12

Nauphal