Hello
I have a site. For not i just check the size of the image and if it is bigger than a size i just do not upload it. Is there a way to reduce the size and upload it later?
Thank you
DiskFileUpload fu = new DiskFileUpload();
FileItem fi4=null;
try{
fileItems=fu.parseRequest(request);
}
catch (Exception e){
System.err.println("Error here-------------------");
}
try{
//getting the parameter
itr=fileItems.iterator();
}catch (Exception e){
System.err.println("There is an error here-------------------");
}
fi4=(FileItem)itr.next();
//taking the filename
String filename=fi4.getName();
//taking the filesize
long filesize=fi4.getSize();
String thepath="images/restaurant";
if (filesize>maxsize){
//i want to resize the image here to be at the correct maxfilesize
}
File fNew= new File(request.getRealPath(thepath), filename);
System.err.println("Got thereeeee");
fi4.write(fNew);