具有自定义数据的Dropzone

时间:2019-05-31 06:41:41

标签: php

我正在尝试在CI中将带dropzone的常规数据插入,但没有发生,文件索引显示为未定义。我已经尝试了所有可能的解决方案。在此先感谢

控制器文件

public function add()
    {
        if($_POST)
        {
            //$file = $this->input->post('file');
            print_r($this->input->post());
            echo ($_FILES['file']['name']);
            exit();
            //my view script
            <script>

                //Disabling autoDiscover
                Dropzone.autoDiscover = false;

                $(function() {
                    //Dropzone class
                    var myDropzone = new Dropzone(".dropzone", {
                        url: "<?php echo base_url();?>admin/car/add",
                        paramName: "file",
                        maxFilesize: 5,
                        maxFiles: 10,
                        parallelUploads: 10,
                        acceptedFiles: "image/*,application/pdf",
                        autoProcessQueue: false
                    });

                 myDropzone.on('sending', function(file, xhr, formData){
                    formData.append('file', file);
                    formData.append('fuel', $("#fuel").val());
                });

0 个答案:

没有答案