WHEN CONTRUCTING AN INSTANCE OF MUTIPARTREQUEST THE "." NEED TO BE REPLACED BY THE
RELATIVE OR ABSOLUTE DIRECTORY NAME WHERE U WANT TO STORE THE FILE.

bye
khem,

Sivakumar Sankarasubramanian wrote:

> Hi ,
>
> I'm presently working on MultipartRequest in my JSP page. I'm able to
> retrieve the parameter values and also the File and save it in the default
> directory. The only problem is that I want it to save in a particular
> directory which i specify. Can somebody throw light on this, with snippets.
>
> My code goes like this
>
> -----------
> <%@ page language="java" import="java.util.Vector, proposal.*,
> com.oreilly.servlet.*;"%>
> <jsp:useBean id="prop" class ="proposal.ProposalItemBean" scope="session"/>
>         <%
>
>                 MultipartRequest multi = new MultipartRequest(request, ".",5
> * 1024 * 1024 ) ;
>
>                 prop.propUser.setFname(multi.getParameter("FirstName")) ;
>                 prop.propUser.setLname(multi.getParameter("LastName")) ;
>                 prop.propUser.setAdd1(multi.getParameter("Add1")) ;
>                 prop.propUser.setAdd2(multi.getParameter("Add2")) ;
>                 prop.propUser.setCity(multi.getParameter("City")) ;
>                 prop.propUser.setState(multi.getParameter("State")) ;
>                 prop.propUser.setCountry(multi.getParameter("Country")) ;
>                 prop.propUser.setZip(multi.getParameter("Zip")) ;
>                 prop.propUser.setPhone(multi.getParameter("Phone")) ;
>                 prop.propUser.setFax(multi.getParameter("Fax")) ;
>                 prop.propUser.setEmail(multi.getParameter("Email")) ;
>                 prop.propUser.setUrl(multi.getParameter("Url"));
>                 prop.propUser.setExtn(multi.getParameter("Extn"));
>         prop.propUser.setZip4(multi.getParameter("Zip4")) ;
>         %>
>
> This automatically saves the file/files in the default root directory.
>  "." is the root  and 5*1024*1024 indicates the max size of file.
>
> ----------
>
> Regards
>
> Siva
>
> -----Original Message-----
> From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 13, 2000 2:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: uploading a file
>
> Pedro Meza wrote:
> >
> > I am trying to use JSP to upload a file.
> >
> > Does anyone have bean code to do this ????
> >
> > If I have a form with a FILE element how is this passed to the bean ????
>
> File uploading is done through a special encoding (multipart/form-data)
> of a POST request, and JSP pages do not deal with this type of encoding
> easily. You're much better off using a regular servlet for uploading.
>
> A commonly used file upload servlet is Jason Hunter's, available at
> <http://www.servlets.com/resources/index.html>. Also, search through
> the archives for this mailing list and SERVLETS-INTEREST since this
> has been discussed many, many, many times before ...
>
> Hans
> --
> Hans Bergsten           [EMAIL PROTECTED]
> Gefion Software         http://www.gefionsoftware.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

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

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to