jijo-paulose / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
0 stars 0 forks source link

Feature Request: Extra field for a custom upload Status message #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi
We use your nifty lib to upload Excel files in a custom format.
Now, there are several possible format errors we want to present to the
user, but currently gwtupload supports only one single ERROR Status.

I would propose an extra (String) field 'StatusMsg' where the client can
put some custom Error message (or Code), similar to the HTTP Protocol.
Would this be possible?
Else my coworker wants to switch to the upload control provided by ext-gwt:
http://www.extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/form/FileUplo
adField.html
(But I doubt it provides the same power as gwtupload)
thx,
Laurent

Original issue reported on code.google.com by laurent....@gmail.com on 27 Nov 2009 at 10:06

GoogleCodeExporter commented 8 years ago
Hello laurent

I see at least two solutions to your problem, you can put in your interface a 
textbox
which can be read when the file input changes (use 
`addOnStatusChangedHandler`),  then:
- Add this value to the query string
`setServletPath(".../myservlet.upld?userinput=whatever")` and read it in the 
server
side with `request.getParameter("userinput")`
- Or add a hidden input to the uploader `add(new Hidden("userinput", 
"whatever"))`
which will be available in the server as a element in the `FileItem` collection

About GXT, I think it would be possible to use gwtupload if you are able to 
wrap its
widget and implement `IFileInput` which uses `Uploader` but I've not play with 
it. 

Regards
Manolo

Original comment by manuel.carrasco.m on 14 Dec 2009 at 1:08

GoogleCodeExporter commented 8 years ago
It is not necessary to add anything to the library because the 
`uploader.add(Widget)`
method does it.

Thanks
Manuel Carrasco Moñino

Original comment by manuel.carrasco.m on 16 Dec 2009 at 9:24

GoogleCodeExporter commented 8 years ago

Hello manuel.carrasco.m 
i added hidden to uploader.add(Widget). but i don't know how take it from 
server side.
tell me how to do this . tnx 

Original comment by A.nyamda...@gmail.com on 29 Nov 2010 at 7:51

GoogleCodeExporter commented 8 years ago
Hope this helps you

@Override
 public String executeAction(HttpServletRequest request, List<FileItem> sessionFiles) throws UploadActionException {
    String response = "";
    int cont = 0;
    for (FileItem item : sessionFiles) {
      if (true == item.isFormField()) {
         // handle a normal form field
      } else {
         // handle the file
      }

Original comment by manuel.carrasco.m on 29 Nov 2010 at 1:24