如何将polymer中的文件上载到服务器并在那里接收。特别是图像文件

如何将polymer中的文件上载到服务器并在那里接收。特别是图像文件,polymer,Polymer,我正在使用polymer,不知道是否有一些成功的Javascript可以做到这一点。 我的javascript似乎无法发送到服务器端 谢谢 <input type="file" name="uploadfile" id="file" on-change="{{setFiles}}" ></input> 您能在问题中加入您的尝试吗?尽管我已经解决了,但还是非常感谢。您能发布解决方案供其他人学习吗?您好,下面是实现这一点的代码。 <paper-fab mi

我正在使用polymer,不知道是否有一些成功的Javascript可以做到这一点。 我的javascript似乎无法发送到服务器端

谢谢

<input type="file" name="uploadfile"  id="file" on-change="{{setFiles}}" ></input>

您能在问题中加入您的尝试吗?尽管我已经解决了,但还是非常感谢。您能发布解决方案供其他人学习吗?您好,下面是实现这一点的代码。
     <paper-fab mini id="submit" src="../images/broadcast.png" 
             on-tap="{{onSubmit}}" ></paper-fab>

      <core-ajax id="ajaxUrl"  url="" method="GET" on-core-response="{{respHandle}}"  ></core-ajax>
  // var dropdown /*global*/= [
  //   'Main Screen AD',
  //   'List View AD',
  //   'Interstitial AD'];   // these variables are shared by all instances of app-globals
  Polymer('ad-form',{ 
    setFiles: function(e, detail, sender) {

      var formData = new FormData();
      for (var i = 0, f;  f= sender.files[i]; ++i) {
        formData.append(sender.name, f,f.name);
      }
    this.$.ajaxdata.body = formData;
    // Override default type set by core-ajax.
    // Allow browser to set the mime multipart content type itself. 
    this.$.ajaxdata.contentType = null;

    }


      onSubmit:function () {
       this.$.ajaxUrl.url =this.$.ajaxUrl.url+"?description="+this.$.description.value;
      // if(!this.validateQuantity()){
      //   alert('Please make sure use only positive numbers for Life Span');
      //   return; 
      // }
      if (!this.$.file.files.length) {
        alert('Please include a file');
        return; 
      }

     this.$.ajaxUrl.go();
    }

});