duanqiu9104 2016-12-23 08:39
浏览 122
已采纳

dropzone post文件和数据

I have a problem when sending my files these last do not post

<div class="container"><form role="form" method="post" action="upload.php" class="dropzone" id="mydropzone" enctype="multipart/form-data">
<input type="hidden" name="additionaldata" value="1" /> 
<div class="form-group">
  <label  for="email">De</label>
  <input type="email" class="form-control "  name="email" placeholder="user@example.com" required />
  <span class="icon fa fa-envelope fa-lg"></span>
</div>
<div class="form-group">
  <label for="sub">Sujet</label>
  <input type="text" class="form-control "  name="sujet" placeholder="Sujet" required/>
  <span class="icon fa fa-pencil fa-lg"></span>
</div>
<div class="form-group">
  <textarea rows="5" cols="30"  name="msg" placeholder="Bonjour, insérer votre Message" style="width:100%"></textarea>
  <span class="icon-textarea fa fa-paper-plane fa-lg "></span>
</div>
<div class="dropzone-previews"></div>
<div><button id="submit-all" type="submit" class="btn btn default">Submit</button>
</div>
</form>

and my config dropzone

Dropzone.options.mydropzone = {        
        url: "upload.php" ,
        paramName: "file",
        previewsContainer: "#dropzone-previews", 
        autoProcessQueue: false,
        uploadMultiple: true, 
        addRemoveLinks:true,
        parallelUploads: 100,
        maxFiles: 100,
        acceptedFiles:".jpeg, .jpg, .jpe, .bmp, .png, .gif, .ico, .tiff, .tif, .svg, .svgz, 
\
                       .doc,.docx,.txt, .pdf,.rtf,.xlsx,.xls,.csv, .ppt,
\
                       .zip,.zipx,.tar,.gz,.z,.rar",
    init: function () {
    var submitButton = document.querySelector("#submit-all") 
    var myDropzone = this;

submitButton.addEventListener("click", function() {
myDropzone.processQueue(); 
});
this.on("sendingmultiple", function() {
});
this.on("successmultiple", function(files, response) {
     });
this.on("errormultiple", function(files, response) {
});
}
}

my upload.php for check post

<?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);
}

I am well directed to the page upload but this last remains blank nothing is send thank for your help

  • 写回答

1条回答 默认 最新

  • duandeng2265 2016-12-23 18:44
    关注

    You need to access the response from the server in the successmultiple or errormultiple events:

    As exemple, to display the response in the console:

    this.on("successmultiple", function(files, response) {
        console.log(response);
    });
    this.on("errormultiple", function(files, response) {
        console.log(response);
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历