<dom-module id="upload-button">
<template>
<iron-ajax
id="advertURL"
auto
url="https:\\app-spot.com/get_upload_url"
handle-as="json"
method="GET"
last-response="{{returned_url}}">
</iron-ajax>
<iron-ajax
id="advertsub"
auto="[[false]]"
url="{{returned_url}}"
handle-as="json"
method="POST"
params='{{params_advert}}'
on-response="_returnedResp">
</iron-ajax>
<input hidden name="myupload" id="file"
value="{{fileName::change}}" on-change="readURL" type="file" class="upload"
/>
</template>
<script>
Polymer({
is:'upload-button',
readURL: function(t) {
var e =t.srcElement;
var formData = new FormData();
for (var i = 0, f; f= e.files[i]; ++i) {
formData.append(e.name, f,f.name);
}
this.$.advertsub.body = formData;
this.$.advertsub.contentType = null;
this.$.advertsub.generateRequest();
},
_returnedResp:function(e){
console.log(e.detail.response);
}
});
</script>
</dom-module>
*WHEN I TRY TO select an image and sends i get.*
XMLHttpRequest cannot load
http://localhost:8080/_ah/upload/ahFwcmVjaXNlLXJheS05NDAwMHIiCxIVX19CbG9iVXBsb2FkU2Vzc2lvbl9fGICAgICAgIAJDA.
No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'http://localhost' is therefore not allowed access.
add-advert.html:183
HOW DO I HANDLE THIS?
My server uses the blobstore to handle the image.
I have even added the Access-Control-Allow-Origin on the server redirect
header but still i failed.
*Onyancha Chrispinus*
Developer
creativeDNA (U) LTD. <http://www.creativedna.co.ug>
@Google Plus <https://plus.google.com/+ChrispinusOnyancha> , @LinkedIn
<http://ug.linkedin.com/in/ChrispinusOnyancha>, @Tweeter
<https://twitter.com/Chrisp_onyanx>
<https://play.google.com/store/apps/details?id=com.creativeDNA.ntvuganda&rdid=com.creativeDNA.ntvuganda&rdot=1&feature=md>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/CADw0wkOPpN8hZ45TAmAeWuqnEt24AcFw63nr%3DRtHH2Uc6aVpQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.