/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new AdaptiveFileUpload(input, memoryThreshold, uploadPath, maxFileSize, breakOnError, fileExtensions, allowFileExtensions); }
/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new MemoryFileUpload(input, maxFileSize); }
public DiskFileUploadFactory(final String destFolder, final int maxFileSize) throws IOException { setUploadDir(destFolder); this.maxFileSize = maxFileSize; }
/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new DiskFileUpload(input, destFolder, maxFileSize); }
/** * Determines if upload is allowed. */ protected boolean checkUpload() throws IOException { if (fileExtensions != null) { if (!matchFileExtension()) { return false; } } return true; }
public MultipartStreamParser(final FileUploadFactory fileUploadFactory) { this.fileUploadFactory = (fileUploadFactory == null ? new MemoryFileUploadFactory() : fileUploadFactory); }
/** * Writes file uploaded item. */ public File write(final String destination) throws IOException { return write(new File(destination)); }
protected boolean matchFileExtension() throws IOException { String fileNameExtension = FileNameUtil.getExtension(getHeader().getFileName()); for (String fileExtension : fileExtensions) { if (fileNameExtension.equalsIgnoreCase(fileExtension)) { if (!allowFileExtensions) { // extension matched and it is not allowed if (breakOnError) { throw new IOException("Upload filename extension not allowed: " + fileNameExtension); } size = input.skipToBoundary(); return false; } return true; // extension matched and it is allowed. } } if (allowFileExtensions) { // extension is not one of the allowed ones. if (breakOnError) { throw new IOException("Upload filename extension not allowed: " + fileNameExtension); } size = input.skipToBoundary(); return false; } return true; }
@Override protected void processStream() throws IOException { if (!checkUpload()) { return;
public FileUploader() { this.fileUploadFactory = new AdaptiveFileUploadFactory(); }
/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new AdaptiveFileUpload(input, memoryThreshold, uploadPath, maxFileSize, breakOnError, fileExtensions, allowFileExtensions); }
/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new MemoryFileUpload(input, maxFileSize); }
public DiskFileUploadFactory(final String destFolder, final int maxFileSize) throws IOException { setUploadDir(destFolder); this.maxFileSize = maxFileSize; }
/** * {@inheritDoc} */ @Override public FileUpload create(final MultipartRequestInputStream input) { return new DiskFileUpload(input, destFolder, maxFileSize); }
/** * Determines if upload is allowed. */ protected boolean checkUpload() throws IOException { if (fileExtensions != null) { if (!matchFileExtension()) { return false; } } return true; }
public MultipartStreamParser(final FileUploadFactory fileUploadFactory) { this.fileUploadFactory = (fileUploadFactory == null ? new MemoryFileUploadFactory() : fileUploadFactory); }
/** * Writes file uploaded item. */ public File write(final String destination) throws IOException { return write(new File(destination)); }
protected boolean matchFileExtension() throws IOException { String fileNameExtension = FileNameUtil.getExtension(getHeader().getFileName()); for (String fileExtension : fileExtensions) { if (fileNameExtension.equalsIgnoreCase(fileExtension)) { if (!allowFileExtensions) { // extension matched and it is not allowed if (breakOnError) { throw new IOException("Upload filename extension not allowed: " + fileNameExtension); } size = input.skipToBoundary(); return false; } return true; // extension matched and it is allowed. } } if (allowFileExtensions) { // extension is not one of the allowed ones. if (breakOnError) { throw new IOException("Upload filename extension not allowed: " + fileNameExtension); } size = input.skipToBoundary(); return false; } return true; }
@Override protected void processStream() throws IOException { if (!checkUpload()) { return;