Created
September 2, 2013 03:26
-
-
Save harssh/6408964 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var manualuploader = new qq.FineUploader({ | |
callbacks : { | |
onComplete : function(id, name, response) { | |
} | |
}, | |
element : $('#<%= type%>_manual-fine-uploader')[0], | |
request : { | |
customHeaders: { | |
'X-CSRF-Token': csrf_token | |
}, | |
endpoint : "/admin/gallery_images/upload_image", | |
params : { | |
tag : "<%= type %>" , | |
} | |
}, | |
multiple : false, | |
autoUpload : true, | |
text : { | |
uploadButton : '<i class="icon-plus icon-white"></i> Select Files </br> Maximum upload size less than 2 MB' | |
}, | |
validation : { | |
allowedExtensions : ['jpeg', 'jpg', 'gif', 'png'], | |
//sizeLimit: 51200, // 50 kB = 50 * 1024 bytes (hint text) | |
sizeLimit : 2097152//, // 2 MB = 2 * 1024 * 1024 bytes | |
//itemLimit : 6 (hint text) | |
}, | |
callbacks : { | |
onComplete : function(id, fileName, responseJSON) { | |
if (responseJSON.success) { | |
apply_image_after_upload_for_<%= type %>(responseJSON.data); | |
} | |
} | |
} | |
}); | |
$('#triggerUpload').click(function() { | |
manualuploader.uploadStoredFiles(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment