Javascript play framework中存在错误的文件描述符异常
我在尝试将图像inputstream复制到特定路径时遇到此错误 如果图像大小小于7kb,我不会收到任何错误 我使用fileuploader()作为上传图像的媒介 我的服务器端代码在play framework 1.3中 游戏框架中的Java代码Javascript play framework中存在错误的文件描述符异常,javascript,java,jquery,playframework,valums-file-uploader,Javascript,Java,Jquery,Playframework,Valums File Uploader,我在尝试将图像inputstream复制到特定路径时遇到此错误 如果图像大小小于7kb,我不会收到任何错误 我使用fileuploader()作为上传图像的媒介 我的服务器端代码在play framework 1.3中 游戏框架中的Java代码 private static File makeFile() { File file = null; String UPLOAD_PATH = getUploadPath(); Logger.log4j.info("starting
private static File makeFile() {
File file = null;
String UPLOAD_PATH = getUploadPath();
Logger.log4j.info("starting the upload progress");
if (request.isNew) {
FileOutputStream moveTo = null;
// Another way I used to grab the name of the file
String filename = request.params.get("qqfile");
Logger.info("Absolute on where to send %s", UPLOAD_PATH + File.separator);
InputStream data = null;
try {
data = request.body;
File up = new File(UPLOAD_PATH);
if (!up.exists()) {
Logger.log4j.info("making directory " + up.getAbsolutePath() + ", result is : "
+ up.mkdir());
}
File inputDoc = new File(UPLOAD_PATH + File.separator + filename);
moveTo = new FileOutputStream(inputDoc);
Logger.log4j.info("copying file to local system");
IOUtils.copy(data, moveTo);
Logger.log4j.info("file copied to local system : " + inputDoc.getAbsolutePath());
moveTo.close();
file = inputDoc;
} catch (Exception ex) {
Logger.log4j.error(ex.getMessage(), ex);
} finally {
if (data != null) {
Logger.log4j.info("closing data input stream");
try {
data.close();
} catch (Exception ex) {
Logger.log4j.error(ex.getMessage(), ex);
}
}
}
}
return file;
}
我在IOUtils.copy(data,moveTo)遇到异常
我得到了一份工作日志
java.io.IOException: Bad file descriptor
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:198)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1262)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236)
at controllers.AbstractUIController.makeFile(AbstractUIController.java:326)
你能告诉我们错误是什么吗?我已经更新了问题。请检查一下