<small id='0zmgP'></small><noframes id='0zmgP'>

      <i id='0zmgP'><tr id='0zmgP'><dt id='0zmgP'><q id='0zmgP'><span id='0zmgP'><b id='0zmgP'><form id='0zmgP'><ins id='0zmgP'></ins><ul id='0zmgP'></ul><sub id='0zmgP'></sub></form><legend id='0zmgP'></legend><bdo id='0zmgP'><pre id='0zmgP'><center id='0zmgP'></center></pre></bdo></b><th id='0zmgP'></th></span></q></dt></tr></i><div id='0zmgP'><tfoot id='0zmgP'></tfoot><dl id='0zmgP'><fieldset id='0zmgP'></fieldset></dl></div>
      <legend id='0zmgP'><style id='0zmgP'><dir id='0zmgP'><q id='0zmgP'></q></dir></style></legend><tfoot id='0zmgP'></tfoot>

          <bdo id='0zmgP'></bdo><ul id='0zmgP'></ul>
      1. 使用 PHP 检索上传的 Blob

        Retrieve Uploaded Blob with PHP(使用 PHP 检索上传的 Blob)
            <legend id='UrB0A'><style id='UrB0A'><dir id='UrB0A'><q id='UrB0A'></q></dir></style></legend>

              <bdo id='UrB0A'></bdo><ul id='UrB0A'></ul>

              <i id='UrB0A'><tr id='UrB0A'><dt id='UrB0A'><q id='UrB0A'><span id='UrB0A'><b id='UrB0A'><form id='UrB0A'><ins id='UrB0A'></ins><ul id='UrB0A'></ul><sub id='UrB0A'></sub></form><legend id='UrB0A'></legend><bdo id='UrB0A'><pre id='UrB0A'><center id='UrB0A'></center></pre></bdo></b><th id='UrB0A'></th></span></q></dt></tr></i><div id='UrB0A'><tfoot id='UrB0A'></tfoot><dl id='UrB0A'><fieldset id='UrB0A'></fieldset></dl></div>
                  <tbody id='UrB0A'></tbody>

                <small id='UrB0A'></small><noframes id='UrB0A'>

              1. <tfoot id='UrB0A'></tfoot>

                  本文介绍了使用 PHP 检索上传的 Blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个创建 blob 并将其发布到 PHP 文件的脚本.这是我的代码:

                  I have a script that is creating a blob and posting it to a PHP file. Here is my code:

                  HTML/Javascript:

                  <script type="text/javascript">
                      function upload() {
                  
                      var data = new FormData();
                      data.append('user', 'person');
                  
                      var oReq = new XMLHttpRequest();
                      oReq.open("POST", 'upload.php', true);
                      oReq.onload = function (oEvent) {
                        // Uploaded.
                      };
                  
                      var blob = new Blob(['abc123'], {type: 'text/plain'});
                  
                      oReq.send(blob);
                  }
                  </script>
                  
                  <button type="button" onclick="upload()">Click Me!</button>
                  

                  PHP:

                  <?php
                  var_dump($_POST);
                  ?>
                  

                  当我查看我的开发人员控制台时,我的 PHP 页面上没有收到任何 $_POST 数据.我需要知道如何检索发布到 PHP 脚本的文本文件.

                  When I look at my developer console, I am not getting any $_POST data on my PHP page. I need to know how to retrieve the text file being posted to PHP script.

                  非常感谢任何帮助!

                  推荐答案

                  可以从 php://input 中读取 blob 中的数据,如

                  The data from the blob can be read from php://input, as in

                  <?php
                  var_dump(file_get_contents('php://input'));
                  

                  但是,如果您想使用表单数据对象发送多条数据,它就像一个普通的多部分/表单数据帖子.所有字符串都可以通过 $_POST 获得,所有 blob 和文件都可以通过 $_FILES 获得.

                  If however you want to send multiple pieces of data with a form data object it would be like a normal multipart/form-data post. All string would be available through $_POST and all blobs and file through $_FILES.

                  function upload() {
                  
                      var data = new FormData();
                      var oReq = new XMLHttpRequest();
                      oReq.open("POST", 'upload.php', true);
                      oReq.onload = function (oEvent) {
                        // Uploaded.
                      };
                  
                      var blob = new Blob(['abc123'], {type: 'text/plain'});
                      data.append('file', blob);
                      oReq.send(data);
                  }
                  

                  这篇关于使用 PHP 检索上传的 Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                        <bdo id='Do2id'></bdo><ul id='Do2id'></ul>
                      • <tfoot id='Do2id'></tfoot>
                        • <small id='Do2id'></small><noframes id='Do2id'>

                          1. <legend id='Do2id'><style id='Do2id'><dir id='Do2id'><q id='Do2id'></q></dir></style></legend>

                            <i id='Do2id'><tr id='Do2id'><dt id='Do2id'><q id='Do2id'><span id='Do2id'><b id='Do2id'><form id='Do2id'><ins id='Do2id'></ins><ul id='Do2id'></ul><sub id='Do2id'></sub></form><legend id='Do2id'></legend><bdo id='Do2id'><pre id='Do2id'><center id='Do2id'></center></pre></bdo></b><th id='Do2id'></th></span></q></dt></tr></i><div id='Do2id'><tfoot id='Do2id'></tfoot><dl id='Do2id'><fieldset id='Do2id'></fieldset></dl></div>
                              <tbody id='Do2id'></tbody>