Hi,
Use Apache FileUpload API. That will get FileItem object(s) from the
Multipart request, which should help you extract the file name and
content. You can strip out the path information and get just the file
name to store.
http://jakarta.apache.org/commons/fileupload/
-cheers,
Manish
Guan - 24 Oct 2006 09:44 GMT
Hi Manish,
Thanks for the reply. i shall read thru the API recommended.
> Hi,
>
[quoted text clipped - 7 lines]
> -cheers,
> Manish
Guan - 26 Oct 2006 05:58 GMT
Hi,
i included the following code to my program just to test it out.
However i encountered an error when running this line List items =
upload.parseRequest(request); during compliation
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.util.List;
import com.oroinc.net.ftp.*;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.DiskFileUpload;
..............
.............
// first check if the upload request coming in is a multipart request
boolean isMultipart = FileUpload.isMultipartContent(request);
// parse this request by the handler
DiskFileUpload upload = new DiskFileUpload();
// this gives us a list of items from the request
List items = upload.parseRequest(request);
------------------------------------------------------------------------------------------------------
The error displayed in the Jcreator description :
unreported exception
org.apache.commons.fileupload.FileUploadException;must be caught or
declared to be thrown
> Hi,
>
[quoted text clipped - 7 lines]
> -cheers,
> Manish
Manish Pandit - 26 Oct 2006 06:10 GMT
You need to catch the FileUploadException. If you are not familiar with
Exception Handling in Java, I'd recommend reading some tutorials and
understanding it.
-cheers,
Manish
Guan - 04 Nov 2006 07:16 GMT
Hi Manish,
Thanks for your help. I have completed the upload part.
Is there any recommendation Class for the downloading of the file from
the server?
Thanks
> You need to catch the FileUploadException. If you are not familiar with
> Exception Handling in Java, I'd recommend reading some tutorials and
> understanding it.
>
> -cheers,
> Manish