javascript - How do I make an image act as a upload file button -
i want make image act button when pressed allows me upload image.
what have right part in snippet want make pull image server act button , run ajax not have reload page display image chosen (the previous image should change 1 chosen).
.uploadbtn { position: relative; overflow: hidden; padding: 10px 20px; text-transform: uppercase; color: #fff; background: #000066; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; width: 100px; text-align: center; cursor: pointer; } .uploadbtn .input-upload { position: absolute; top: 0; right: 0; margin: 0; padding: 0; opacity: 0; height: 100%; width: 100%; }
<div class="uploadbtn"> <input type="file" class="input-upload" /> <span>image</span> </div>
<input type="image" src="image.jpg" />
this standard way of using image in place of button in html form.
Comments
Post a Comment