0

I am trying to upload an image on server using JSP. I want to upload the file using only JSP without Servlet. Suggest me the simplest code with jar files needed I am using the following code but its not working.

<html>
 <head>
  <title>File Uploading Form</title>
  </head>

  <body>
  <h3>File Upload:</h3>
  Select a file to upload: <br />
  <form action = "UploadServlet" method = "post"
     enctype = "multipart/form-data">
     <input type = "file" name = "file" size = "50" />
     <br />
     <input type = "submit" value = "Upload File" />
    </form>
  
   <%@ page import="com.oreilly.servlet.MultipartRequest" %>  
    <%  
      MultipartRequest m = new MultipartRequest(request, "d:/new");  
     out.print("successfully uploaded");  
     %>  
    </body>
    </html>
adesh singh
  • 1,690
  • 9
  • 38
  • 69
  • Using JSP this way is frowned on here. But, if you can't use Servlets then look at https://stackoverflow.com/questions/37965890/add-annotation-to-jsp and https://stackoverflow.com/questions/2422468/how-can-i-upload-files-to-a-server-using-jsp-servlet/2424824#2424824 – rickz Mar 15 '22 at 15:23

0 Answers0