Look into using Struts.  It does all the hard part for u
----- Original Message -----
From: "Wilson Edgar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 8:54 AM
Subject: Re: upload


hi paulo,
i had the same dilema a couple of weeks ago...
this is a transcript of the answer i got from charles conover, so, thank him
:>)
hope this helps

" This is very difficult to do.  It is funny that the html is so
easy, but actually retrieving the file is so difficult.  First, the form
must be a multipart form like this:

<form method="POST" enctype="multipart/form-data"
action="yourfile.html">

I'm afraid I do not know JSP, but only use servlets.  For a Servlet
request, I use Jason Hunter's MultipartParser class at
www.servlets.com/cos/javadoc/com/oreilly/servlet/multipart/MultipartPars
er.html

Then, after declaring the MultipartRequest like this:

Multi = new MultipartRequest(req, Directory, maxsize, filename,
OverwriteType);

You have to parse through the parameter names:

Enumeration params = multi.getParameterNames();
<go through enumeration here in a while loop and set your parameters>

Then, get the file names:

Enumeration files = multi.getFileNames();

Then, finally get your file(s):

While (files.hasMoreElements()) {
  String name = (String)files.nextElement();
  String filename = multi.getFilesystemName(name);
  String type = multi.getContentType(name);
  File f = multi.getFile(name);
  Vars.put(String.valueOf(i),filename);
}

Not easy, huh? "

-----Mensagem original-----
De: Paulo Sergio Ebling [mailto:[EMAIL PROTECTED]]
Enviada: ter�a-feira, 2 de Abril de 2002 5:33
Para: [EMAIL PROTECTED]
Assunto: upload


Please,

I sorry for my English and thanks for all contributions!!!!



Are you know how to implement an upload?

I want to upload files from clients to server machine.

I don't know how to manipulate the uploaded file from the server side.

Take a look bellow. It's a html file that will upload a file  to the server.

<HTML>
<form action="recarq.jsp">
 <input type=file  name="_arq">
 <input type=submit>
</form>
</HTML>

Now, take a look bellow. It's a jsp file that will receave an uploaded file.
Here is the problem. I just can take the uploaded file name. I want to take
the content of the uploaded file to save on the server.
How can I do this?? Can you help me?

<%@ page import= "java.util.*" %>
<%
  String s= "";
  s = request.getParameter("_arq");
%>
<html>
<body>
<%=s%>
</body>
</html>


Thanks a lot!

Paulo Ebling,
Brazil - RS

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

=========================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to