com.orielly.servlet  is hvin Best APIs to deal with
all fine of file operation.

in client side  << this way u are accessing File System of client machine
and uploading the file
<form action="xyz.jsp or servlet"  method=POST
Enctype="multipart/form-data">
       ||
       ||
<input type=FILE size=50 name=filename>
:
</form>

in jsp/servlet
1>   import com.oreilly.servlet.*;   // first download this Apis
2>  MultipartRequest multi = new MultipartRequest(request,"."); // here ur
mutipart request
3>  Enumeration files = multi.getFileNames(); // gettinng all fine name
using Enum...
        while (files.hasMoreElements()) { // for all file
        String name = (String)files.nextElement(); // it is file name
        filename = multi.getFilesystemName(name);// file system name
       String type = multi.getContentType(name );// type
       File f = multi.getFile(name);//
       if (f != null) {
       out.println("\nf.toString(): " + f.toString());
      out.println("\nf.getName(): " + f.getName());
       out.println("\nf.exists(): " + f.exists());
       out.println("\nf.length(): " + f.length());
       out.println();

hope it will help u.
       ----- Original Message -----
From: Muddaser Azeem <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 5:59 PM
Subject: What does a File Input tag return?


> I'm developing A online file manager. Like Xdrive.com.
> I'm using JSP with JAva beans . i'v a form in which
> i'v placed a HTML file Input tag. i'm posting this
> page to a JSP page whch is using a bean and i'm
> apssing a pagecontext object to the bean. In bean i'm
> trying to get the data of the selected file from the
> client by getting the request inputstream and then
> reading binary data but it doesn't behave like i'm
> expecting it. Here is the code.
>
> m_totalBytes = m_request.getContentLength();
> m_binArray = new byte[m_totalBytes];
> while (totalRead < m_totalBytes)
> {
>     try
>     {
>       m_request.getInputStream();
>       readBytes =
> m_request.getInputStream().readLine(m_binArray,
> totalRead, m_totalBytes - totalRead);
>                 totalRead += readBytes;
>     }
>     catch (Exception e)
>     {
>         System.out.print (e);
>     }
> }
>
> in this m_binArray is a byte array which is supposed
> to receieve the data in the file. but it never do like
> this.
>
>
> Plz help me out.
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.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://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


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.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://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