0

Basically I have a form which inside it I have File input, now I want to know how to send the choosen file to server using jquery ajax and how to receive the sent file in java EE

<div class="browsephoto_div">
<form class="image" method="POST">
    <label class="takeapicture_btn">
        <input type="file" accept=".png, .gif, .jpeg, .jpg" id="imagetoupload" onchange="loadFile(event)" required/>
        <span>Browse</span>
    </label>
</form>
</div>

<script>
var loadFile = function(event) {
var output = document.getElementById('imagetoupload');
alert(output.value);
};
</script>
Jorden
  • 41
  • 1
  • 6
  • What do you mean "receive the sent file in java EE"? Java EE is the specification only, not the server, and not a particular technology. – Sergey Gornostaev Sep 06 '16 at 04:12

1 Answers1

0

what you are trying to achieve is not clear, but i am assuming that you want to select the file and then send it servlet for further processing.

check the link
ajax-file-upload-to-a-java-servlet-in-html5
ajax-file-upload-to-a-java-servlet-in-html5
how-to-upload-files-to-server-using-jsp-servlet-and-ajax

Community
  • 1
  • 1
Rishal
  • 1,480
  • 1
  • 11
  • 19