Thursday, June 18, 2009

Grails Super File Upload plugin complete and uploaded (mind the pun!)

Ho ho ho

I have uploaded and released my latest Grails plugin

Super File Upload

Finally you can easily style your file upload control and have a fully working progress bar with it.

If you want to see it action then head to my new website www.ebookstamper.com

Enjoy :)

12 comments:

jimmy said...

thanks for your great plugin...

Greg said...

Peter -- Thanks for the great plugin. I am getting a -200 error during upload ... any suggestions ?

Gorbas said...

Is there any way to retrieve the original file name?

Roshan said...

I haven't actually tried your plugin yet, but I seem to recall that the SWFUpload flash component had problems connecting to a "protected" backend Grails controller from FireFox (Worked with IE). A solution was to enable appending JSESSIONID (which is now disabled by default in Grails).

Does this affect the plugin?

Anonymous said...

I have the same query as Gorbas "How can i retrieve the original file name"

Tu Long said...

seems to be very good, but doesnt work with grails 1.2.0.

1. after plugin install you still get: unable to resolve class SuperFileUploadService

2. After picking the image and pressing submit. you get the error: "Error submitting form"

These errors make this plug in unusable ... or is there anything else you should add besides the steps in documentation?

DreamerForever said...

@Tu Long: You need to import it like this first:
import com.solution51.sfu.SuperFileUploadService

If you open the zip package of the plugin you will see that the SuperFileUploadService is in com.solutions51.sfu package :)

Great Plugin, but how to retrieve original file name without too much hacking ??

DreamerForever said...

Gorbas:

You can get the filename if you add another hidden field to the form, I added one with name attribute "filename" and id "#filename"

Just before the upload, you extract the value from swfupload text field to your hidden field...

$("#sbm").click(function(){
var val =$("#swfupload_text").val(); $("#filename").val(val);
});

Now you ca obtain the filename in you controller action with params.filename

Now you have to use the renameTo method in the java.io.File...search jdk.

Hope this helps.

Patrick Haggood said...

Using in Grail 1.2.1 - when I place the tag in the header of my mainapp.gsp form which loads the actual upload form via template, I get the following error: loadsg:exception: "Could not find the placeholder element: swfupload_btn" - the doc page says all the tag properties save 'form' are optional, is this doc out of date or am I using this tag incorrectly?

Anonymous said...

Great plugin!
But how can I manage empty upload file in the form?
I use a form where users can upload files, but this is not a must.
When I now click on the submit button the progress bar appears and nothing else happens. The form ist not submitted.
Thanks for help.

Anonymous said...

@DreamerForever: If you're still out there... I'm trying to follow your recommended approach for retrieving a filename via a hidden field "just before the submit" but am having a hard time with the script you provided:

"...Just before the upload, you extract the value from swfupload text field to your hidden field...

$("#sbm").click(function(){
var val =$("#swfupload_text").val();
$("#filename").val(val);
});


Can you (or anyone) tell me exactly how to use this script in my .GSP? Thanks!

Anonymous said...

bug occurs.

plz update the plugin because so many problems...

TODO:
1. empty file problem.
2. limit the file name extension.
3. createLinkTo -> resource.