i want to upload a file from a form with core-ajax. Right now it my code looks like this:
<core-ajax
auto="false"
method="POST"
url="/file-upload"
handleAs="json"
on-core-response="{{handleResponse}}"
contentType="multipart/form-data; boundary=---------------------------7da24f2e50046"
params="{{item}}"
id="ajax"></core-ajax>
<form>
<input type="text" name="Name" id="name"></br>
<label class="formLine">File</label></br>
<input type="file" name="File" id="file"></br>
<paper-button raisedbutton="" label="send" role="button" aria-label="disabled" class="formLine" on-tap="{{click}}"></paper-button>
</form>
with the following javascript-code:
click: function(){
var name = this.$.name;
var File = this.$.file;
this.item = {
'Name': name.value,
'File':File.value
};
this.$.ajax.go();
}
So when i send the request there is no data to process. In the previous version i handled this with a regular form and used multiparty to parse the request.
How should i send and handle the data?