zoukankan      html  css  js  c++  java
  • XMLHttpRequest post 传递多个参数及服务器端读取

    一直没搞定XMLHttpRequest  post方法如何传递多种参数,比如同时读取post参数和file参数

     var http = new XMLHttpRequest();

     var form = new FormData();
            // Add selected file to form
            form.append(me.getName(), file);
            form.append('filename', '1.png');
            // Send form with file using XMLHttpRequest POST request
            http.open('POST', me.getUrl());
            http.send(form);


    服务器端

           $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);        
           $uploadfile = $uploaddir . basename($_POST['filename']);   

  • 相关阅读:
    设计模式——策略模式
    LeetCode
    平凡世界里的万千思绪
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3028598.html
Copyright © 2011-2022 走看看