<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" import="java.io.*" import="java.util.*" import="org.apache.commons.fileupload.*" errorPage="" %><%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <% FileItem photo=null; String picture_id = ""; String real_pic_name = ""; int count = 0; boolean isMultipart = FileUpload.isMultipartContent(request); if (isMultipart) { // Create a new file upload handler DiskFileUpload upload = new DiskFileUpload(); // Set upload parameters upload.setSizeMax(500*1024); // 100Kb //upload.setRepositoryPath("c:/temp"); // Parse the request List items = upload.parseRequest(request); Iterator it = items.iterator(); while (it.hasNext()) { FileItem fitem = (FileItem) it.next(); if (!fitem.isFormField()) { //fitem.write(new File(getServletContext().getRealPath("/")+"/realtors/r"+request.getParameter("realtor_id")+".jpg")); photo = fitem; //test = getServletContext().getRealPath("/"); } else { String name = fitem.getFieldName(); if("picture_id".equals(name)) picture_id = fitem.getString(); } } if(photo!=null) { real_pic_name = picture_id; String img1 = "pictures/"+ picture_id + ".jpg"; String realPathToImage = application.getRealPath(img1); java.io.File imageFile = new java.io.File(realPathToImage); if(imageFile.exists()) { real_pic_name = picture_id + "_0"; count++; do { img1 = "pictures/"+ real_pic_name +".jpg"; realPathToImage = application.getRealPath(img1); imageFile = new java.io.File(realPathToImage); if(imageFile.exists()) { real_pic_name = picture_id + "_" + count; count++; } }while(imageFile.exists() && count<14); } photo.write(new File(application.getRealPath("pictures")+"/"+real_pic_name+".jpg")); count++; } } else { picture_id = request.getParameter("picture_id"); String img1 = "pictures/"+ picture_id + ".jpg"; String realPathToImage = application.getRealPath(img1); java.io.File imageFile = new java.io.File(realPathToImage); if(imageFile.exists()) { real_pic_name = picture_id + "_0"; count++; do { img1 = "pictures/"+ real_pic_name +".jpg"; realPathToImage = application.getRealPath(img1); imageFile = new java.io.File(realPathToImage); if(imageFile.exists()) { real_pic_name = picture_id + "_" + count; count++; } }while(imageFile.exists() && count<14); } } %> Property pciture upload
Add a new picture
You can add up to 15 pictures on FRBOBeta.com. After the upload you can see how the picture will look like.

The file size is limited to 200Kb and bigger pictures will not be stored. We suggest that you use your image manipulation software to reduce the size of the picture. If you don't know how, There are several sites like www.reducephoto.com or www.shrinkpictures.com that can help you.

">
<% if(count>0) {%> property picutre <%}%> <% if(count>1) {%> property picutre <%}%> <% if(count>2) {%> property picutre <%}%>
<% if(count>3) {%> property picutre <%}%> <% if(count>4) {%> property picutre <%}%> <% if(count>5) {%> property picutre <%}%>
<% if(count>6) {%> property picutre <%}%> <% if(count>7) {%> property picutre <%}%> <% if(count>8) {%> property picutre <%}%>
<% if(count>9) {%> property picutre <%}%> <% if(count>10) {%> property picutre <%}%> <% if(count>11) {%> property picutre <%}%>
<% if(count>12) {%> property picutre <%}%> <% if(count>13) {%> property picutre <%}%> <% if(count>14) {%> property picutre <%}%>