0

In JavaScript, I made blob and ObjectURL for the blob.

However I'm not sure how I could send this blob to Servlet so I could store in Google App Engine Storage.

By searching on Google, I found I could upload file to Servlet by using the following code.

<form method="POST" action="upload" enctype="multipart/form-data" >
        <hidden input type="file" name="file" id="file" /> <br/>
        <input type="submit" value="Upload" name="upload" id="upload" />

However, I still can't figure out how to put my blob in that form.

So, this is what I've written so far.

function saveRecording(blob) {
url = URL.createObjectURL(blob);
html = "<form method=\"POST\" action=\"upload\" enctype=\"multipart/form-data\" >" +
.... +
"<input type=\"submit\" value=\"Upload\" name=\"upload\" id=\"upload\" />"

$recordingList.prepend($(html));

}

I also had tried to send blobURL to Servlet and let Servlet to download the blob file from the URL but it also didn't work...

Thank you.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Lebanner
  • 77
  • 1
  • 1
  • 9
  • Even though I am seeing [object Blob] in the request information from Chrome, null is returned. – Lebanner Mar 27 '16 at 20:14
  • Click the link in end of paragraph *"As to the servlet side, no special stuff needs to be done here. Just implement it exactly the same way as you would do when not using Ajax"* in the current duplicate. – BalusC Mar 27 '16 at 20:17

0 Answers0