@Override public void transferTo(File dest) throws IOException, IllegalStateException { this.part.write(dest.getPath()); if (dest.isAbsolute() && !dest.exists()) { // Servlet 3.0 Part.write is not guaranteed to support absolute file paths: // may translate the given path to a relative location within a temp dir // (e.g. on Jetty whereas Tomcat and Undertow detect absolute paths). // At least we offloaded the file from memory storage; it'll get deleted // from the temp dir eventually in any case. And for our user's purposes, // we can manually copy it to the requested location as a fallback. FileCopyUtils.copy(this.part.getInputStream(), Files.newOutputStream(dest.toPath())); } }
@Override public void transferTo(File dest) throws IOException, IllegalStateException { this.part.write(dest.getPath()); if (dest.isAbsolute() && !dest.exists()) { // Servlet 3.0 Part.write is not guaranteed to support absolute file paths: // may translate the given path to a relative location within a temp dir // (e.g. on Jetty whereas Tomcat and Undertow detect absolute paths). // At least we offloaded the file from memory storage; it'll get deleted // from the temp dir eventually in any case. And for our user's purposes, // we can manually copy it to the requested location as a fallback. FileCopyUtils.copy(this.part.getInputStream(), Files.newOutputStream(dest.toPath())); } }
@Override public File file() throws IOException { if (file == null) { String name = "tmp-" + Long.toHexString(System.currentTimeMillis()) + "." + name(); upload.write(name); file = new File(tmpdir, name); } return file; }
/** * A convenience method to write this uploaded item to disk. * * @param fileName the name of the file to which the stream will be * written. The file is created relative to the location as * specified in the Application * * @throws IOException if an error occurs. */ public void write(String fileName) throws IOException { part.write(fileName); }
@Override public void write(String fileName) throws IOException { part.write(fileName); }
@Override public void transferTo(File dest) throws IOException, IllegalStateException { part.write(dest.getPath()); } }
/** * A convenience method to write this uploaded item to disk. * * @param fileName the name of the file to which the stream will be * written. The file is created relative to the location as * specified in the Application * * @throws IOException if an error occurs. */ public void write(String fileName) throws IOException { part.write(fileName); }
@Override public void write(String fileName) throws IOException { synchronized(lock) { part.write(fileName); } }
String fileName: Part part = request.getPart("file"); if (part != null){ fileName = extractFileName(part); } else{ fileName = "avatar.jpg"; } String filePath = savePath + File.separator + fileName; part.write(filePath); request.setAttribute("Pic", filePath); request.setAttribute("PicName", fileName);
@Override public void write(String filePath) throws Exception { part.write(filePath); }
@Override public void write(String fileName) throws IOException { part.write(fileName); }
@Override public void write(File file) throws Exception { part.write(file.getName()); }
@Override public void write(File file) throws Exception { part.write(file.getName()); }
@Override public File file() throws IOException { if (file == null) { String name = "tmp-" + Long.toHexString(System.currentTimeMillis()) + "." + name(); upload.write(name); file = new File(tmpdir, name); } return file; }
@Override public void upload(String uploadPath) throws IOException { File uploadDir = new File(uploadPath); if(!uploadDir.exists()){ uploadDir.mkdirs(); } part.write(uploadPath + "/" + getFileName()); }
@Override public void write(String fileName) throws IOException { getWrapped().write(fileName); }
public void write(String fileName) throws IOException { getWrapped().write(fileName); }
@Override public void write(final String fileName) throws IOException { getWrapped().write(fileName); }
@Override public void transferTo(File dest) throws IOException, IllegalStateException { this.part.write(dest.getPath()); if (dest.isAbsolute() && !dest.exists()) { // Servlet 3.0 Part.write is not guaranteed to support absolute file paths: // may translate the given path to a relative location within a temp dir // (e.g. on Jetty whereas Tomcat and Undertow detect absolute paths). // At least we offloaded the file from memory storage; it'll get deleted // from the temp dir eventually in any case. And for our user's purposes, // we can manually copy it to the requested location as a fallback. FileCopyUtils.copy(this.part.getInputStream(), Files.newOutputStream(dest.toPath())); } }