my testing case is almost the same as the example in icefaces-seam-component show case. But somehow the file did not get saved on the disk. I logged the absolute directory path of the file saved. I'm using Icefaces 1.8.1 and seam 2.1.2.
@Name("inputFileController")
@Scope(ScopeType.SESSION)
public class InputFileController implements Serializable{
@Logger private Log log;
// File sizes used to generate formatted label
public static final long MEGABYTE_LENGTH_BYTES = 1048000l;
public static final long KILOBYTE_LENGTH_BYTES = 1024l;
// files associated with the current user
private final List<InputFileData> fileList =
Collections.synchronizedList(new ArrayList<InputFileData>());
// latest file uploaded by client
private InputFileData currentFile;
private String parentDirectory="";
private int progress;
public void uploadFile(ActionEvent event){
InputFile inputFile= (InputFile)event.getSource();
log.info("uploadFile has been called. Status: "+inputFile.getFileInfo().getStatus());
if(inputFile.getFileInfo().getStatus()==inputFile.SAVED){
if(this.parentDirectory.equals("")){
this.parentDirectory = inputFile.getFile().getParent();
}
log.info("the absolute path of the uploaded file is " + inputFile.getFile().getAbsolutePath());
InputFileData currentFile = new InputFileData(inputFile.getFileInfo());
synchronized (fileList) {
if (!listContains(currentFile.getFile().getName())){
//only add the file to the list if it isn't already there
//fileupload will just update a more recent version of the file
fileList.add(currentFile);
}
}
}
}
public void fileuploadProgress(EventObject event){
InputFile ifile = (InputFile) event.getSource();
progress = ifile.getFileInfo().getPercent();
}
@BypassInterceptors
public int getProgress(){
return progress;
}
}
and no exception popped up. The progress bar works, just the file is not there.
When you are stating that your file was not "saved", did you actually check the server location that you have designated/specified for the upload area? (from web.xml). Or are you simply referring to a listing you may have on your facelets page? (which might just be a result of the last "push" after the file is uploaded not occuring and you would set submitOnUpload="postUpload" for).
In your backing bean, you could always put an "else" statement to see what the status of the inputFile is. (if it's not SAVED).
When you are stating that your file was not "saved", did you actually check the server location that you have designated/specified for the upload area? (from web.xml). Or are you simply referring to a listing you may have on your facelets page? (which might just be a result of the last "push" after the file is uploaded not occuring and you would set submitOnUpload="postUpload" for).
In your backing bean, you could always put an "else" statement to see what the status of the inputFile is. (if it's not SAVED).
Sorry for the confusion. I meant that the file data is not retained on the disk. I specified "/upload/" as the directory in the web.xml. but somehow the directory is always empty. And the status inputFile gives to me is SAVED.
My facelets page is rather simple, no attempt to display the list of the uploaded files.