Hi to all, Is there a way to limit the upload size of a file? lets say i dont want the file to be more than 10mb please any help or tips or hints would be appreciated
put this code in UploadFileServlet.java 's service method for loop's each block —–
if (filename != null && filename.length() != 0) { if ( item.getSize() < YourFileSizeLimit ) { if (logger.isDebugEnabled()) { logger.debug("Processing uploaded file: " + filename); } // workaround a bug in IE where the full path is returned // IE is only available for Windows so only check for the Windows path separator filename = FilenameUtils.getName(filename); final File tempFile = TempFileProvider.createTempFile("alfresco", ".upload"); item.write(tempFile); bean.setFile(tempFile); bean.setFileName(filename); bean.setFilePath(tempFile.getAbsolutePath()); if (logger.isDebugEnabled()) { logger.debug("Temp file: " + tempFile.getAbsolutePath() + " size " + tempFile.length() + " bytes created from upload filename: " + filename); }