dcsimg
Uploading a Zip file through JSP
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Priti_Sawant
Posted On:   Wednesday, February 18, 2004 12:04 PM

In my JSP application i want to let the users upload a zip file which i can than extract at the server side. But i am not sure how can i do this. The JSP page has a text field of type "File". I am trying to get the value of this field & sent it to the Java function which takes as argument a File to unzip. But i get the error incompatible types. found : java.lang.String required: java.io.File [CODE] MultipartRequest multi = null; File filen = null; filen = multi.getFilesystemName("filename"); [/CODE] Any help is appreciated Thanx    More>>


In my JSP application i want to let the users upload a zip file which i can than extract at the server side.


But i am not sure how can i do this.
The JSP page has a text field of type "File". I am trying to get the value of this field & sent it to the Java function which takes as argument a File to unzip. But i get the error incompatible types.
found : java.lang.String
required: java.io.File




[CODE]






MultipartRequest multi = null;

File filen = null;

filen = multi.getFilesystemName("filename");

[/CODE]

Any help is appreciated
Thanx    <<Less

Re: Uploading a Zip file through JSP

Posted By:   Rajesh_Mohapatra  
Posted On:   Thursday, February 19, 2004 02:49 AM

HI,

I dont remember the exact code but once the file gets uploaded, u have to use the java.io.zip package/classes to unzip the file.

As per the error I can read , it seems you are trying to cast the value to string which is wrong.
There are sample codes in the api u are trying to use to upload a file, refer to them, once the file is uplaoded use the above package/classes.



tnx
About | Sitemap | Contact