title: How to download BLOB from MySQL using Spring MVC framework
body: <p>I have created the code for uploading a pdf file into the BLOB of MySQL database.</p>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;form method="post" action="doUpload" enctype="multipart/form-data"&gt;
      &lt;table border="0"&gt;
          &lt;tr&gt;
              &lt;td&gt;Pick file #1:&lt;/td&gt;
              &lt;td&gt;&lt;input type="file" name="fileUpload" size="50" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td colspan="2" align="center"&gt;&lt;input type="submit" value="Upload" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
       &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Spring Controller:</p>
  
  <pre><code>@RequestMapping(value = "/doUpload", method = RequestMethod.POST)
  public String handleFileUpload(HttpServletRequest request,
          @RequestParam CommonsMultipartFile[] fileUpload) throws Exception {
  
      if (fileUpload != null &amp;&amp; fileUpload.length &gt; 0) {
          for (CommonsMultipartFile aFile : fileUpload) {
              System.out.println("Saving file: " + aFile.getOriginalFilename());
              UploadFile uploadFile = new UploadFile();
              uploadFile.setFileName(aFile.getOriginalFilename());
              uploadFile.setData(aFile.getBytes());
              fileUploadDao.save(uploadFile);                
          }
      }
      return "Success";
  }
  </code></pre>
  
  <p>I could able to upload the PDF File into the blob field of <strong>MySQL table</strong>. But I don't know how to retrieve the blob data, as a hyperlink, where I can click the link and download the pdf file. Kindly help me.</p>