voyent
FileEntry upload issue - validation error message is not allowing upload any files  XML
Forum Index -> General Help
Author Message
vsathishkumar83

Joined: 07/Jun/2017 19:14:06
Messages: 2
Offline


We have a web application which is deployed in tomcat 6.0.26.
File upload was working fine earlier and suddenly it's started throwing the validation error message saying 'documentFileUpload' has failed uploading because 'test.pdf' is an invalid file.
This message is not from our validate method and It’s from the ICE Face API (FaceMessage)
We have 5 severs configured in load balancer. All the server has same code, out of 5 server one server is having this issue.

Configuration Details:
ICEfaces 3.0.1
jdk1.6.0_21
apache-tomcat-6.0.26

Sample code
fileUpload.xhtml
<ice:panelGroup>
<ace:fileEntry id="documentFileUpload" absolutePath="#{parentBean.fileUploadPath}" useSessionSubdir="true" useOriginalFilename="true"
style="width:500px;" maxFileCount="1" fileEntryListener="#{parentBean.uploadActionListener}" />
</ice:panelGroup>


Bean.java
public void uploadActionListener(FileEntryEvent actionEvent) {
FileEntry fileEntry = (FileEntry) actionEvent.getSource();
FileEntryResults results = fileEntry.getResults();
for (FileEntryResults.FileInfo fileInfo : results.getFiles()) {
if (fileInfo.isSaved()) {
if (this.validateNewFileUpload(fileInfo)) {
//
}
}
}
private boolean validateNewFileUpload(FileInfo fileInfo) {

if (fileInfo == null)
return false;

File file = fileInfo.getFile();

boolean valid = true;

if (fileInfo.getStatus() == FileEntryStatuses.INVALID) {
logger.error("File is invalid.");
this.getErrorMessages().add("File is invalid.");
valid = false;
}

if (fileInfo.getStatus() == FileEntryStatuses.MAX_FILE_SIZE_EXCEEDED) {
logger.error("File is larger than the maximum size.");
this.getErrorMessages().add("File is larger than the maximum size.");
valid = false;
}
if (fileInfo.getStatus() == FileEntryStatuses.INVALID_CONTENT_TYPE) {
logger.error("File type is invalid.");
this.getErrorMessages().add("File type is invalid.");
valid = false;
}

if (fileInfo.getStatus() == FileEntryStatuses.UNSPECIFIED_NAME) {
logger.error("Unspecified file name.");
this.getErrorMessages().add("The file name was not specified.");
valid = false;
}

return valid;
}

Please help us, if anyone knows the root cause of this issue or having any solutions.
vsathishkumar83

Joined: 07/Jun/2017 19:14:06
Messages: 2
Offline


We found the Root Cause of this issue and have the solution now.

Root cause : Upload directory has reached the max no.of sub folders.
Solution : Clean up the directory.
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team