Hi folks, I'm having some trouble with ERAttachment in dealing with files that are too large for the pre-set file-size limit (2MB in this case).
<wo:ERAttachmentUpload
configurationName="Fundraiser.image"
editingContext="$ec"
attachment="$fundraiser.image"
name="custom_image"
id="custom_image"
cleanup="$true"
/>
I catch the ERXAttachmentExceedsLengthException in my WOComponent's
invokeAction():
@Override
public WOActionResults invokeAction(com.webobjects.appserver.WORequest
aRequest, com.webobjects.appserver.WOContext aContext) {
try {
WOActionResults result = super.invokeAction(aRequest,
aContext);
return result;
} catch (ERXAttachmentExceedsLengthException e) {
log.debug(String.format("ERXAttachmentExceedsLengthException was thrown and
caught"));
fundraiser.setValidationException("Your uploaded image
was too large (limit is 2MB). Please reduce the size of your image and try
again.");
return null;
}
}
That works OK and sends the user back to the data entry page to try a new file.
The problem is that when they try a new file I get another error:
IllegalStateException:
<er.extensions.foundation.ERXPatcher$DynamicElementsPatches$FileUpload> No form
data left for WOFileUpload!
After much playing about including the 'Ajax' and 'Flexible' variants I still
can't make WO "forget" about the previous upload and effectively re-set the
file upload process. Some googling shows that "No form data left for
WOFileUpload!' is often associated with bad form encoding, but that's set OK.
(enctype="multipart/form-data").
The file upload progress is somehow wrapped into the Component somehow, but I
can't seem to re-set it. If invokeAction() is the wrong place to do what I'm
doing, where else can I intercept the ERXAttachmentExceedsLengthException?
Using latest versions of WO, Wonder and [OSX 10.7] Java.
Thanks for reading.
.neilmac
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
