Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Uploading Image File Through JSP Code To Server
sendto
post Jan 3 2006, 02:14 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 3
Joined: 2-January 06
Member No.: 10,435



I have to upload images from client side to server side, without using input tag or browseing of file. I know the absolute path of file in client side. And that file I want to shift to server with JSP code or any servlet code. I have done uploading through servlet to the server with input tag and type is file .

Servlet code :
CODE
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");
}
}



This code needs oreilly Image package API
Can anyone help me to upload to file without using

<form method=post type =encrpted>

<input type=”file” name= “uploadfile”>



if I use <input type=”file” name= “uploadfile” value=”c:\temp\myphoto.jpg”>
it doesn’t work..

Notice from moonwitch:
We require you to pour large chunks of code into the code tags.
Reduced Credits by 6 days
Go to the top of the page
 
+Quote Post
uapconsole
post Feb 28 2006, 10:06 PM
Post #2


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 24
Joined: 10-February 06
Member No.: 11,194



I am using Sun Studio Creator 2 to deploy the calendar control in the web browser, using JSP. When I compile with the calendar control, its fine and it displays properly on Firefox, but it doesn't display properly on Internet Explorer.

Is this a common mobility problem with this control? I believe there might be another explanation. I'd appreciate any help, thank you.

- Demirelli
Go to the top of the page
 
+Quote Post
Ola Daniel
post Jun 15 2006, 08:55 PM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 15
Joined: 15-June 06
Member No.: 13,954



QUOTE
This code needs oreilly Image package API
Can anyone help me to upload to file without using

<form method=post type =encrpted>

<input type=”file” name= “uploadfile”>

if I use <input type=”file” name= “uploadfile” value=”c:\temp\myphoto.jpg”>
it doesn’t work..


Sendo of course doing this "<input type=”file” name= “uploadfile” value=”c:\temp\myphoto.jpg”>" will not work. You are attempting to breach the security of your client machine. Imagine the havoc a web developers could wreak on a client machine if he could pick files from the client's machine at will without active participation from the client.

You cannot, i repeat cannot upload a file from a client machine without PERMISSION being given to you by the client.

I would suggest using an applet to copy the file from the client machine since you know the location of what you need the upload. Of course your applet has to be signed and your user has to accept your applet certificate. This way he has given you persmission to read and write files from his machine.

If you do not understand my explanation. let me know i will be more than happy to explain further.

This post has been edited by Ola Daniel: Jun 15 2006, 08:57 PM
Go to the top of the page
 
+Quote Post
masiel
post Jul 13 2007, 05:00 PM
Post #4


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 1
Joined: 13-July 07
Member No.: 23,339



cm hago por favor a tener mi prpoa bae de datos en esta web, con JSP para guardar mis datos y consultarla despues
Go to the top of the page
 
+Quote Post
iGuest
post Oct 2 2007, 11:46 AM
Post #5


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



Please exclude your own package

-chirag
Go to the top of the page
 
+Quote Post
iGuest
post Jan 29 2008, 07:14 PM
Post #6


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



how to copy an image from one location to other using jsp code,having apache web server 6.0?
Uploading Image File Through JSP Code To Server

Q> How to copy an image from one location to other using jsp code,having apache web server 6.0?

-Shubhadip Bera
Go to the top of the page
 
+Quote Post
iGuest
post Feb 9 2008, 11:00 AM
Post #7


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



image uploading problem
Uploading Image File Through JSP Code To Server

Hi,

My problem is I have the path of the image now I need to write a jsp to send this file to web server that is on client machine.Please help how to do it.



-smita
Go to the top of the page
 
+Quote Post
iGuest
post May 8 2008, 05:49 AM
Post #8


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



files in JSP
Uploading Image File Through JSP Code To Server

How to input file and how to store and fetch it from database in jsp with database MS Access 2000

-reply by Gautam Verma
Go to the top of the page
 
+Quote Post
iGuest
post Jun 9 2008, 09:04 AM
Post #9


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



Dears

How to store a uploaded JPEG file ino the database and how to disppaly it in JSP page. Please give me the code.

Pankaj Kumar


-reply by pankaj
Go to the top of the page
 
+Quote Post
iGuest
post Jul 30 2008, 12:06 PM
Post #10


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Code To Send An Email From A Form(10)
  2. How To Mount A Cd Image(13)
  3. Mini Apache Server W/ Php(5)
  4. Counter With Img In Flat File(2)
  5. How To: Create PDF With Php(18)
  6. Anyone Know Of Any Good Image Editing Software?(24)
  7. How To Make A Good Sig Image!(6)
  8. Restore Windows File And Folder Protection(5)
  9. What Is Mkv? Need Help With This File Format?(7)
  10. Rapidshare(1)
  11. Counter-Strike Source Clans - Post Your Server IPs(15)
  12. Super File Recover(3)
  13. You Cannot Create A File Named Con(9)
  14. How To Create Exe File In Java?(13)
  15. How Do You Use The cPanel File Manager?(14)
  1. Free Code Snippets And Css Layout(14)
  2. Deleting A Corrupt File(26)
  3. How To Set Up A Dedicated Server(28)
  4. Help: Setting Default Index Page on XAMPP Web-Server(3)
  5. Free Ragnarok Online Server(5)
  6. Image Problems With Windows 2000(9)
  7. Create An Ftp Server On Your Pc With Serv-u(1)
  8. Activation Code(7)
  9. Instant Replay Code?(0)
  10. New Ro Server(2)
  11. Wamp Server Problems(5)
  12. Css File Size(7)
  13. Server With Quest?(4)


 



- Lo-Fi Version Time is now: 12th October 2008 - 03:35 PM