Upload using blobstore, then hit "back"

95 views
Skip to first unread message

Yasser

unread,
Jan 16, 2011, 3:40:57 PM1/16/11
to tipfy
Hey everyone,

Another session related question:
When I upload a file using the blobstore, and hit "back" in the
browser to get back to the upload form to upload another file, I get
this error:
Could not find session for
agpzaW1wbGVwaHlkchsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18Yfww

AFAIK, the blobstore generates a session for each upload, and when I
hit back, the browser gives me the same cached page and the blobstore
doesn't renew my session for another upload - hence it gives me this
error.

Is there a way around that?

As a temp solution, I'm using JS to refresh the page if a user gets
back to it that way, which isn't ideal..

Thanks for your help!
Yasser

yinhm

unread,
Jan 17, 2011, 8:45:18 PM1/17/11
to ti...@googlegroups.com
You could set header to tell browser not cache the page or using
JavaScript to get the upload URL when user picked files.

> --
> You received this message because you are subscribed to the Google Groups "tipfy" group.
> To post to this group, send email to ti...@googlegroups.com.
> To unsubscribe from this group, send email to tipfy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tipfy?hl=en.
>
>

--
Regards,
@yinhm
Friendfeed: https://friendfeed.com/yinhm
有微码头:http://yinhm.appspot.com
github: https://github.com/yinhm

Simon Payne

unread,
Jan 18, 2011, 5:27:07 PM1/18/11
to ti...@googlegroups.com
You could send ajax request to get the blobstore-session-url and add it to the form via js on the page with form, which I'm cosindering right now..

Yasser

unread,
Jan 23, 2011, 2:46:16 PM1/23/11
to tipfy
@ynihim: I tried that, it didn't work

@Simon: sounds like a good idea - I'll give it a try!

Noah McIlraith

unread,
Jan 30, 2011, 4:07:37 PM1/30/11
to ti...@googlegroups.com
This is an AppEngine limitation, it seems the agreed upon solution (kludge) is to AJAX in a new upload URL. Obviously, this won't work for browsers that don't support JavaScript or in cases where it's disabled, but I'm sure they encounter a lot of issues not having JavaScript enabled anyway.

Simon Payne

unread,
Jan 30, 2011, 4:33:56 PM1/30/11
to ti...@googlegroups.com
I think i wouldn't be too difficult to create some fall-back variant, for example:
Create a default upload-session-url before the form is shown to the user, and add a JS event listener to the submit button.
If the user pressed the submit button you can store in JS that the form has been already submitted (to invalidate the old session-url) and if someone tries to re-submit it it will try to get new upload-url and then send the form. I'm sure you can use JS to stop the submit event, request for new url and then force the submit again via JS (at least I'm sure know you can do that in MooTools) to send it finally. User won't probably even notice the small delay when waiting for the AJAX request to finish. As I think about it you can also use synchronous request and then you don't event have to cancel the submit event .. :)
So if the user has JS disabled it will just send the contents to the first upload-url and if he hit back he is screwed but at least he has the possibility to actually use the upload form in the first place :D so he is not screwed so much ;) only his browser can screw him... 
Reply all
Reply to author
Forward
0 new messages