Created
October 9, 2011 23:53
-
-
Save ffaerber/1274390 to your computer and use it in GitHub Desktop.
plupload rails 3.1 coffeescript
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
| $(document).ready -> | |
| uploader = new plupload.Uploader | |
| runtimes : "html5", | |
| browse_button : 'pickfiles', | |
| container: 'container', | |
| max_file_size : '10mb', | |
| url : "/media", | |
| multipart: true, | |
| multipart_params: | |
| "authenticity_token" : AUTH_TOKEN | |
| uploader.bind 'Init', (up, params) -> | |
| $('#filelist').html "<div>Current runtime: #{params.runtime} </div>" | |
| uploader.bind 'FilesAdded', (up, files) -> | |
| $.each files, (i, file) -> | |
| $('#filelist').append "<div id='#{file.id}'> #{file.name} (#{ plupload.formatSize file.size }) <b></b></div>" | |
| uploader.bind 'UploadProgress', (up, file) -> | |
| $("##{file.id} b").html "#{file.percent}%" | |
| $('#uploadfiles').click (e) -> | |
| uploader.start() | |
| e.preventDefault() | |
| uploader.init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment