Help with image upload +resize + save to databse.
I up a new to uploading image, so I was if anyone could help.
I have a form that I want users to upload multiple images, image can be any size, those images will need to be saved my Mysql database, up before it saved I want to resize to the image and save resized and renamed images to DB.
Any tips, suggests, code, sample or how it all works together would must helpful, I looked javazoom, uploadbean, however it doesn't have resize facility. I'd prefer to use jsp/servlet rather applet.
Thanks in advanced
[534 byte] By [
Me_mea] at [2007-11-27 11:48:29]

# 3
I have the followinf code which up loads multiple, as I stated ealier am new to this.
I have following could someone suggest, how I can change it save the images to that database? I m using common fileupload. Would it be possible to resize and rename the files before saving it to DB.
<%
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
} else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
Iterator itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
if (item.isFormField()) {
} else {
try {
String itemName = item.getName();
File savedFile = new File(config.getServletContext().getRealPath("/")+"uploadedFiles/"+itemName);
item.write(savedFile);
out.println("<tr><td><b>Your file has been saved at the loaction:</b></td></tr><tr><td><b>"+config.getServletContext().getRealPath("/")+"uploadedFiles"+"\\"+itemName+"</td></tr>");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
%>
Many thanks for your help.
Me_mea at 2007-7-29 18:19:32 >
