zoukankan      html  css  js  c++  java
  • xmlhttprequest请求

    上传

     var xhr = new XMLHttpRequest();
        xhr.open('POST', 'http://posttestserver.com/post.php');
        xhr.onload = () => {
          if (xhr.status !== 200) {
            AlertIOS.alert(
              'Upload failed',
              'Expected HTTP 200 OK response, got ' + xhr.status
            );
            return;
          }
    
          // upload succeeded
          ...
        };
        var formdata = new FormData();
        formdata.append(photo, {type: "image/jpeg", name: ____, uri: ______ });
    
        if (xhr.upload) {
          xhr.upload.onprogress = (event) => {
            console.log('upload onprogress', event);
            if (event.lengthComputable) {
              this.setState({uploadProgress: event.loaded / event.total});
            }
          };
        }
        xhr.send(formdata);
    

      https://github.com/marcshilling/react-native-image-picker/issues/31

  • 相关阅读:
    position中的四种属性
    CSS中link和@import的区别
    隐藏对应元素的办法
    word20161217
    word20161216
    word20161215
    word20161214
    word20161213
    word201612012
    word20161211
  • 原文地址:https://www.cnblogs.com/examine/p/5309875.html
Copyright © 2011-2022 走看看