- Overview
- Documents
Single Upload Image is a jquery plugin that upload a image return image url and custom data. click image button upload, display progress percent, finish display this image into image button
Source: github.com
Jun 29, 2014 in File Upload 6368 views
Single Upload Image is a jquery plugin that upload a image return image url and custom data. click image button upload, display progress percent, finish display this image into image button
Source: github.com
1. INCLUDE JS FILES
<script type="text/javascript" src="jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../source/jquery.singleuploadimage.js"></script>
2. HTML
<div id="uploadbox" onClick="singleupload_input.click();" class="singleupload"></div> <input type="file" id="singleupload_input" style="display:none;" name="img" value=""/>
3. JAVASCRIPT
$(function() { $('#uploadbox').singleupload({ action: 'do_upload.php', //action: 'do_upload.php' inputId: 'singleupload_input', onError: function(code) { console.debug('error code '+res.code); } /* ,onSucess: function(url, data) {} */ /*,onProgress: function(loaded, total) {} */ }); });
4. CSS
.singleupload { background: url(empty_bg.png); border:1px solid #ccc; text-align: center; width: 92px; height: 92px; line-height: 92px; }
Tagged with:
single upload image
upload image
jquery plugin
image url
custom data
button upload
display progress percent
image button
Related Articles