i did file upload in jsp , it uploaded correctly in my program, when i export that into war file and deployed in remote server it not saving my image file into likeimage folder.
i guess my path is not valid in my remote server to save my file..
here my code,
<%@ page import="java.util.List" %>
   <%@ page import="java.util.Iterator" %>
   <%@ page import="java.io.File,java.sql.*" %>
   <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
   <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
   <%@ page import="org.apache.commons.fileupload.*"%>
   <%@ page contentType="text/html;charset=UTF-8" language="java" %>
        <center><h1>Link Detail Uploaded</h1></center>
   <%!
     String linkhead="";
     String linkval="";
     String filenameval="";
     int count1=0,count2=0,count3=0;
 %>
 <%
 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())
       {
          String name = item.getFieldName();
          String value = item.getString();
          if(name.equals("Link_head"))
               {
               linkhead=value;
                     count1=1;
               }
              if(name.equals("Link_val"))
                      {  
                         linkval=value;
                         count2=2;
                      }
              if(name.equals("file"))
              {  
                 filenameval=value;
                 count3=3;
              }
   } else
       {
    try {
   String itemName =item.getName();
   File savedFile = new File(config.getServletContext().getRealPath("/")+"linkimage/"+itemName);
   out.println("\nimage"+itemName);
   out.println("\nimageok: "+filenameval);
   String path=config.getServletContext().getRealPath("/")+"linkimage/"+itemName;
   out.println("\npath     "+path);
   item.write(savedFile);
   Connection con=null;
   Statement st=null;
   try
           {
       Class.forName("com.mysql.jdbc.Driver");
       con=DriverManager.getConnection("jdbc:mysql://localhost:3306/event_db","root","pass@123");
       st=con.createStatement();
       st.executeUpdate("insert into link(link_heading,link_val,image_url) values('"+linkhead+"','"+linkval+"','"+itemName+"')");
   }
catch(Exception e)
        {
    out.println("connetion error"+e);
}
     %><center></table><table ><tr><td width="210"></td><td> <img  border="2" src=linkimage/<%=itemName %> width="137"  height="140"></td></tr></table><table border="2" width="350">
   <% if(count1==1)
             out.println("<tr><td align='left'><b>Link Header:</td><td><b>"+linkhead);
      if(count2==2)  
             out.println("</td><tr><td align='left'><b>Link:</td><td><b>"+linkval);
      } catch (Exception e) {
   e.printStackTrace();
   }
   }
   }
   }
   %>
     </td></tr>
     <tr>
     <td><input type="button"  name="back" value="Back" onClick="javascript:window.location='limkmain.jsp'"></TD>   
        </td>
    <td width="100%" align="center"><a href="linkeditdelete1.jsp" style="font-size:14pt;color:blue;" >Click here to Show Links</a></td>
 </tr>
     </table></center>
give some idea to save my file in remote machine... thanks in advance
 
     
    