Home Tutorialhelp Comment Hi guys, this is jacob if u want to upload it

 
 

Comment

jacob
Hi guys, this is jacob if u want to upload it,
December 5, 2006 at 7:12 PM

Hi guys,

this is jacob if u want to upload it server then this is the code that u have to write in de servlet or jsp , here this code will save the document in contextpath/Documents/filename

String filePath = getServlet().getServletContext().getRealPath("/");
filePath = filePath+"Documents";

File fileToCreate = new File(filePath, fileName);
if(!fileToCreate.exists()){
FileOutputStream fileOutStream = new FileOutputStream(fileToCreate);
fileOutStream.write(documentFile.getFileData());
fileOutStream.flush();
fileOutStream.close();
View All Comments
Advertisement
Related Tutorial and Articles
Advertisements Advertisements
 

 

 

DMCA.com