Question

I use GWT + GAE (JAVA).
I also use the blostore and the GWT file uploader (com.google.gwt.user.client.ui.FileUpload). Technically, the file uploader is inside a form. And I do not know if the error is more related to the GWT fileUploader or to the blobstore...

Here is the scenario :
0) I ask an URL to the blobstore (for example, I receive the URL http://example.url.blobstore).
This URL is used for the action form.

ACTION 1: (successfull)
A) I click on the fileUpload button
B) I choose the image "batman.jpg" and click OK
C) Then I send my form to http://example.url2.blobstore and the blobstore successfully save my image
D) I ask a new URL to the blobstore (cf. step 0)

ACTION 2: (fail)
A) I click again on the file upload button
B) I choose again "batman.jpg"
C) I cannot see the image loading in the preview...so I deduce that I cannot load 2 times the same image.
D) I rename my file in "batman_1.jpg" and I load it via the file uploader.
E) Then I can submit my form, and my image is saved.
G) I ask a new URL to the blobstore (cf. step 0)

I have to change the name of the image, or I have to refresh my page to upload this image again.
I do not know how to solve this issue, it is painfull to change the image name 10 times if I need to use it at 10 differents places in my application.

Thanks you,

Was it helpful?

Solution

I have solved the issue with :

fileUpload.getElement().setPropertyString("value", "");

OTHER TIPS

Did you create a new Form element? it is possible the Form cannot do a post twice with the same data. Maybe it's a browser optimisation for persons who double click on the submit button.

It's just a supposition, but try recreating the form widget onSuccess or even hide the form onSubmit (actually onClick is better) and show another form to the user

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top