• <small id='NKPvO'></small><noframes id='NKPvO'>

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

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

        使用 dropzone 向后端发送附加数据

        Send additional data with dropzone to the backend(使用 dropzone 向后端发送附加数据)
      1. <legend id='cIUtb'><style id='cIUtb'><dir id='cIUtb'><q id='cIUtb'></q></dir></style></legend>

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

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

              • <bdo id='cIUtb'></bdo><ul id='cIUtb'></ul>
                <tfoot id='cIUtb'></tfoot>
                    <tbody id='cIUtb'></tbody>
                  本文介绍了使用 dropzone 向后端发送附加数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试通过 dropzone 将图像文件的特定 - 已经知道 - 位置 ID 发送到后端,该 ID 将上传到服务器上.虽然正在使用 formData.append(),但我看到没有附加任何内容.而只是显示了这个FormData {}".

                  I am trying to send through dropzone a specific -already known- position ID of an image file to the backend, which is going to be uploaded on the server. Although the formData.append() is being used, I see that nothing is appended.Instead just this "FormData {}" shows up.

                  dropzoneObject.on("sending", function(file, xhr, formData){
                      var nameOfFile = $(file.previewElement).find(".dz-filename").text();
                      var positionOfFile = fpos;
                      //console.log("The file who's being sent is named: "+nameOfFile+" and its position id is: "+positionOfFile);
                      formData.append("fpos", fpos);
                  });
                  

                  我希望在示例中看到 fpos=16;

                  I expect to see in example fpos=16;

                  推荐答案

                  不知道你的具体错误,但这里有一个简单的例子,说明如何使用 jQuery 使用 dropzone 发送附加数据并在后端使用 php 接收它.

                  Don't know about your particular error, but here is a simple example of how to send additional data with dropzone using jQuery and receiving it with php on the backend.

                  html:

                  <form id="myForm" class="dropzone"></form>
                  

                  js:

                  Dropzone.autoDiscover = false;
                  $('.dropzone').dropzone ({
                          url: "upload.php",
                          init: function() {
                              this.on("sending", function(file, xhr, formData){
                                  formData.append("fpos", 777)
                              }),
                              this.on("success", function(file, xhr){
                                  alert(file.xhr.response);
                              })
                          },
                  });
                  

                  成功事件只是为了演示如何访问服务器发送的响应:

                  The success event is only to demonstrate how to access the response send from the server:

                  php:

                  if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') 
                      {
                          echo "RECEIVED ON SERVER: 
                  ";
                          echo "FILES: 
                  ";
                          print_r($_FILES);
                          echo "$_POST: 
                  ";
                          print_r($_POST);
                      }
                  

                  php 只是将接收到的相同数据发送回客户端,只是为了显示可访问的位置.

                  The php simply sends back to client the same data received, just to show where is accessible.

                  这篇关于使用 dropzone 向后端发送附加数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                1. <legend id='FuZuC'><style id='FuZuC'><dir id='FuZuC'><q id='FuZuC'></q></dir></style></legend>
                  <tfoot id='FuZuC'></tfoot>
                      <tbody id='FuZuC'></tbody>
                    <i id='FuZuC'><tr id='FuZuC'><dt id='FuZuC'><q id='FuZuC'><span id='FuZuC'><b id='FuZuC'><form id='FuZuC'><ins id='FuZuC'></ins><ul id='FuZuC'></ul><sub id='FuZuC'></sub></form><legend id='FuZuC'></legend><bdo id='FuZuC'><pre id='FuZuC'><center id='FuZuC'></center></pre></bdo></b><th id='FuZuC'></th></span></q></dt></tr></i><div id='FuZuC'><tfoot id='FuZuC'></tfoot><dl id='FuZuC'><fieldset id='FuZuC'></fieldset></dl></div>
                      <bdo id='FuZuC'></bdo><ul id='FuZuC'></ul>
                    • <small id='FuZuC'></small><noframes id='FuZuC'>