jQuery File Upload

  • Tags: /
  • Latest: 0.2
  • Last Updated: 13 August 2011
  • Grails version: 1.3.7 > *
  • Authors: null
0 vote
Dependency:
compile ":jquery-file-upload:0.2"

 Documentation

Summary

Installation

grails install-plugin jquery-file-upload

Description

Provides common resources for http://aquantum-demo.appspot.com/file-upload and helper tags.

To add basic jquery plugin resources, add the tag <jqfu:resources tmpl=”false” /> tag to the HEAD of your template. And place <jqfu:resources url=”_URL_” /> in the content of your view. The url parameter specify the action URL that actually stores the file in your app. It must return an JSON collection of a maps for each file stored. A returned file map must return at least the file name and file size of the stored file. For example:

def upload = {
   Collection result = []
   Binary binary
   request.getFileNames().each {
     binary = Binary.storeMyFileMethod(request.getFile(it))
     result << [name: binary.getFileName(), size: binary.getFileSize()]
   }
   render result as JSON
}

The jQuery File Upload plugin uses the the jQuery.tmpl plugin to render the user actions. In the above example we turned the jQuery template engine off as the plugin provided an js rendering extension to work out of the box. If you set the “tmpl” parameters in the resources tag, the jQuery.tmpl plugin will be added and you must create your own jquery template.

See http://aquantum-demo.appspot.com/file-upload for more details.