Hi,

I would appreaciate a field error when I try to upload an empty file.

I only find a server log warning
WARN  [org.apache.struts2.interceptor.ActionFileUploadInterceptor] (default 
task-2) Es konnte kein Dateiname für uploadDe ermittelt werden. Überprüfen Sie 
ob eine gültige Datei übermittelt wurde.
(German properties-Key struts.messages.invalid.file=Could not find a Filename 
for {0}. Verify that a valid file was submitted.)

ActionFileUploadInterceptor.intercept runs into the if, so all nice errors from 
acceptFile are not reachable.
            if (uploadedFiles == null || uploadedFiles.length == 0) {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(getTextMessage(action, 
STRUTS_MESSAGES_INVALID_FILE_KEY, new String[]{inputName}));
                }
            } else {
                for (UploadedFile uploadedFile : uploadedFiles) {
                    if (acceptFile(action, uploadedFile, 
uploadedFile.getOriginalName(), uploadedFile.getContentType(), inputName)) {
                        acceptedFiles.add(uploadedFile);
                    }
                }
            }

It seems impossible to write a field error on my own.
(I have 3 upload options, so I can not raise an error if one of them is null.)

Best regards
Ute



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to