0

hello i am new to web project, i want to pass a file and also a text field to a servlet.I could upload file successfully but can't pass text variable into servlet ,it shows null when i try to print.

<div id="view2">
  <b>Upload new Timetable</b>
  <fieldset>
    <h3> Choose File to Upload in Server </h3>
    <form action="FileUploadHandler" method="post" enctype="multipart/form-data">
      <input type="text" name="class_name" id=nam/> 
      <input type="file" name="file" />
      <input type="submit" value="upload" />
    </form>          
  </fieldset>
</div>
Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
Sonzzz
  • 1
  • 1
  • 2
    can you please, post your servlet code ? – Vishal Gajera Feb 09 '16 at 07:49
  • [vishal gajeria] I edited my code like this String description = request.getParameter("class_name"); Part filePart = request.getPart("file"); String fileName = filePart.getSubmittedFileName(); InputStream fileContent = filePart.getInputStream();..... i also added annotation...@MultipartConfig( fileSizeThreshold=1024*1024*10, maxFileSize=1024*1024*50 , maxRequestSize=1024*1024*100 ) – Sonzzz Feb 11 '16 at 10:27

0 Answers0