Wednesday, 16 April 2014

Uploading a file uisng jsp



Hi Guys, Here I explained how to upload a file into your specify folder using JSP. I wrote this program only for the beginners who are all interested to upload their file in folder or Database.
Note : Before coding download the file COS.JAR

Index.html
Top of Form
<form ENCTYPE="multipart/form-data" ACTION="upload.jsp" METHOD=post>
    <center>
        <input type="text" name="t1">
        <input type="file" name="file">
       
      
    </center>
    <input type="submit" value="submit">
 Bottom of Form

Upload.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"  import="com.oreilly.servlet.MultipartRequest"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<%

MultipartRequest m = new MultipartRequest(request,"Folder Location",500000);

Text Box: File maximum limited sizeString filename=m.getFilesystemName("file");
out.println(filename);
%>


</body>
</html>

No comments:

Post a Comment