Try this: 
https://benjaminhorn.io/code/setting-cors-cross-origin-resource-sharing-on-apache-with-correct-response-headers-allowing-everything-through/

I had similar issues until I made the setting: always set header.... along 
with the mod-rewrite rule so that the web server responds with 200 success 
as the API wasn't written to perform that.

On Monday, November 16, 2015 at 10:57:02 PM UTC+11, Eng. Chrispinus 
Onyancha wrote:
>
>
>
>
> <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/5345a5e2-bc85-437c-9ab1-cfa4f26ce92e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to