Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add / Edit forms - Any way to preserve file uploads when form validation errors occur? #43

Open
neilferreira opened this issue Oct 15, 2015 · 5 comments

Comments

@neilferreira
Copy link

Hello

Before I spend too much time digging through the code I figured I'd ask if anyone has already covered this. If I go to add or edit an object that has a NamedBlobImage field on it I can see a file upload widget. If I specify a file but another form validation error occurs my uploaded file is lost. This is particularly frustrating if the upload takes a long time to upload in the first place.

Is there any way to configure the Dexterity forms to not lose the uploaded files when a validation error occurs?

Thankyou.

FYI, I'm using Plone 4.3.

validation

@davisagli
Copy link
Member

I don't think there's currently any infrastructure to handle this, but it would be a really nice feature to have.

SubstanceD does this by putting the files in a temporary directory and a reference to them in the user's session: https://github.com/Pylons/substanced/blob/master/substanced/form/__init__.py

In order to use that approach for Plone we'd want to use a session mechanism that doesn't write to the ZODB temporary store (which tends to cause conflicts and requires setting up session affinity in your load balancer). Maybe a signed cookie.

@datakurre
Copy link
Member

We could do this with plone.app.drafts. I added a simple Dexterity-support for it for Mosaic, but this particular use case is not yet supported (it auto-saves values on validation, but only when the validation passes; also it does not re-use auto-saved values on final save, which would be the case here).

Plone.app.drafts does not require Mosaic. It is activated for content types by enabling drafting behavior.

Plone.app.drafts tries to avoid conflicts by making separate draft BTree for each authenticated user.

@gforcada
Copy link
Member

Couldn't this actually be handled by either session/local storage (HTML 5 new thingies)?

@davisagli
Copy link
Member

Maybe, but:

  • local storage typically has a fairly small size limit
  • it'd be nice to avoid sending the file to the server more than once, if it's a large file

@mauritsvanrees
Copy link
Member

File uploads are preserved now, at least in Plone 5.2. I remember I have seen that, but I don't remember in which package this was done.
@thet You created this feature. Which package was that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants