Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. var drop = $("#upload").dropzone({
  2. uploadMultiple: "true",
  3. addRemoveLinks: "true",
  4. thumbnailWidth: "250",
  5. thumbnailHeight: "250",
  6. maxFilesize: "10",
  7. headers: {
  8. "title": titles,
  9. "location": locations,
  10. "tag": tags
  11. }
  12. });
  13.  
  14. $("#close").click(function(){
  15. drop.removeAllFiles(true);
  16. });
  17.  
  18. $(function() {
  19. Dropzone.options.myAwesomeDropzone = {
  20. init: function () {
  21. var myDropZone = this;
  22. $("#btnRemoveAll").click(function () {
  23. myDropZone.removeAllFiles();
  24. }
  25. );
  26. }
  27.  
  28. };
  29. });
  30.  
  31. mydropzone = new Dropzone("#mydropzone",{
  32. url: "/dropzone",
  33. addRemoveLinks : true,
  34. maxFilesize: 2.0,
  35. dictResponseError: 'Error uploading file!',
  36. removedfile: function(file) {
  37. var name = {file: file.name}
  38. $.ajax({
  39. type: 'POST',
  40. url: '/dropzone_delete',
  41. contentType: 'application/json',
  42. data: JSON.stringify(name),
  43. dataType: 'json',
  44. success: function (e) {console.log(e);}
  45. });
  46. var _ref;
  47. return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
  48. }
  49. });
  50.  
  51. // Clear all files
  52. $("#btn_clear_dropzone").click(function () {
  53. mydropzone.removeAllFiles();
  54. mydropzone.removeAllFiles(true);
  55. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement