I want to implement an upload component in my servlet file,but it doesn't work. The code episode seems like follows:
SmartUpload smartUpload=new SmartUpload();
StringBuffer stringBuffer=new StringBuffer();
smartUpload.initialize(config,request, response);
try {
     smartUpload.upload();
 File file=smartUpload.getFiles().getFile(0);
 stringBuffer.append(file.getFileName());
 file.saveAs("/upload_resources/"+stringBuffer);
} catch (SmartUploadException e) {
 e.printStackTrace();
}
The upload_resource directory is just under the WebRoot directory,the code runs without any errors ,but the file is just not uploaded. By the way , even I changed the line
file.saveAs("/upload_resources/"+stringBuffer);
to
file.saveAs(request.getRealPath("/upload_resources/")+"/"+stringBuffer);
that is to use an absolute path, the file is not uploaded. Any help will be appreciate. Thanks.
 
    