Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to Uploading Image File Through JSP Code To Server


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

Posted 07 May 2011 - 05:30 AM

image is not shownUploading Image File Through JSP Code To Server

I had uploaded the picture and saved the path into database..But I am not able to retrieve the picture..Path is gettable but image is not shown..Below is the code..Do suggest some help..

<%@ page import="java.Io.*,com.Oreilly.Servlet.*" %><%@ page import="java.Sql.*"%><%@ page import="java.Io.*"%><% try {String rno=(String)session.GetAttribute("reg_no"); String tname=null; String aname=null; String cname=null;Final int limit=1024*1024*1024; Class.ForName("oracle.Jdbc.Driver.OracleDriver"); Connection con=DriverManager.GetConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe","anand","sethi"); int I=0; String saveDir=application.GetRealPath("photo"); File f=new File(saveDir); f.Mkdirs(); MultipartRequest mpr=new MultipartRequest(request,application.GetRealPath("photo"),limit); String s1=mpr.GetOriginalFileName("file"); String path=application.GetRealPath("photo"+""+s1); Statement st=con.CreateStatement(); I = st.ExecuteUpdate("update profile set p_path='"+path+"' where reg_no='"+rno+"'"); if(I==1) { out.Println("done"); } else out.Println("not done"); } catch(Exception e) { out.Print("in sql exception"+e); }%>-reply by R.A.Sethi


Posted 22 July 2010 - 11:08 AM

webservice from server to clientUploading Image File Through JSP Code To Server

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


Posted 03 April 2010 - 12:02 PM

sending an image from client to clientUploading Image File Through JSP Code To Server

actually I m developing a chat server in java with the help of sockets but I am unable to send images from one client to other one.Please help me  to provide this code as soon as possible.

thank you in advance.

-question by arya

Posted 26 December 2009 - 07:16 AM

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");}}


Posted 29 August 2009 - 04:42 AM

What is the target path of server when we create a file on server using jspUploading Image File Through JSP Code To Server

I am having a folder like in our application "www.Dname.Com/admin/video/"

Now I need to create a file in the folder, I tried like

File f=mew File(" www.Dname.Com/admin/video/filename.Txt");

but the server does not recognizing the path, it says invalid directory,path

tell me what should I give here 

File f=mew File(" ??????");

Please... Help me

-reply by Asgar

Posted 02 September 2009 - 02:10 AM

can i change the path of uploading image?Uploading Image File Through JSP Code To Server

I have upload a image file using above code...It is working when it deployed in Tomcat..If I use Weblogic server it is storing in some other place.So, My question is...Can I change the path of uploading image?

please reply soon ...

thanks 

Ashok

-reply by Ashok

Posted 23 April 2009 - 04:45 AM

what is the actual format of setting webapps and WEB-INF? where to save jsp files in apache tomcat server?Uploading Image File Through JSP Code To Server

Hello,

Please tell me that how to save the jsp file?what is the right way/path of saving the xml files, jsp files, pojo(pure java files) after insatalling the apache tomcat server where should be placed or saved these all files to compile it or run it?

reply soon ...I m waiting

regards..

-question by Maggi

Posted 26 December 2008 - 12:59 PM

upload file from client to serverUploading Image File Through JSP Code To Server

when I upload using <file> tag, it's not work upload file from client machine but only from server machine ... So I just only got no file found error. ... How should I do?

-reply by nwaynge


Posted 01 December 2008 - 06:38 PM

Uploading images to serverUploading Image File Through JSP Code To ServerReplying to Ola DanielHi there!Can you Please tell me how to upload an image to a specific folder on the web server. M doing it in JSP and asking the user to browse through file upload component.Thankx.-
 
reply by Ashish

Posted 30 July 2008 - 12:06 PM

uploading of image files in jsp
Uploading Image File Through JSP Code To Server

I want to upload image files to the server ,give me the idea or coding to upload the image file

-question by karthi

Review the complete topic (launches new window)