January 3, 2006, 2:14 pm -
Reply -
import com.Oreilly.Servlet.MultipartRequest;Import java.Io.*;Import java.Util.*;Import javax.Servlet.*;Import javax.Servlet.Http.*;public class UploadPhoto extends HttpServlet {Public void doPost(HttpServletRequest req, HttpServletResponse res) Throws ServletException , IOException {Res.SetContentType("text/html");PrintWriter out = res.GetWriter();String rtempfile = File.CreateTempFile("temp","1").GetParent();MultipartRequest multi = new MultipartRequest(req, rtempfile, 500 * 1024); File rnewfile=null;Rnewfile = new File(new File("/").GetAbsolutePath()+File.Separator+"tomcat"+File.Separator+"webapps"+File.Separator+"ROOT"+File.Separator+"Photo"+File.Separator+"YourPhotoname.Jpg");Out.Println("<HTML>");Out.Println("<head><title>UPLOAD PHOTO</title></head>");Out.Println("<body>");Out.Println("<Pre>");Enumeration files = multi.GetFileNames();While (files.HasMoreElements()) {File f = multi.GetFile(name);FileInputStream fin =new FileInputStream(f);ImageInfo ii =new ImageInfo();Ii.SetInput(fin);Fin.Close(); fin =new FileInputStream(f); FileOutPutStream fos =new FileOutPutStream(rnewfile); byte sizefile[] = new byte[500000]; fin.Read(sizefile); fin.Write(sizefile); fos.Close(); Fin.Close();F.Delete();}Res.SendRedirect("Your.Jsp");}}
December 26, 2009, 7:16 am -
Reply -
hi
I need to play a video saved on webserver which is requested by client to view in his mobile device
how to write webservice for the above
Any one pls help me out
suggest me any solutions
Thanx in advance ...
Regards
Nisha
July 22, 2010, 11:08 am -
Reply -