T
T
The Dragger2015-04-06 15:59:58
JavaScript
The Dragger, 2015-04-06 15:59:58

What am I doing wrong when I install dropzonejs on yii?

here is my html here is my javascript
<div id="dropZed" class="dropzone"></div>

$("#dropZed").dropzone({ url: "/admin/MyGallery/create"});
    Dropzone.options.myAwesomeDropzone = {
        paramName: "img_url", // The name that will be used to transfer the file
        method: 'files',
        url: "/admin/MyGallery/create",
        maxFilesize: 2 // MB
    };

here is my php handler
if(isset($_POST['submit'])){
            if($_FILES['img_url']['error'] == 0){
                move_uploaded_file($_FILES['img_url']['tmp_name'],
                Yii::app()->request->baseUrl . 'images/upload/' . $_FILES['img_url']['name']);
            }
        } else echo "ERORR TEXT";
        
            $model->img_url = $_FILES['img_url']['name'];
            $model->save()

but in the end I get an error
Undefined index: img_url ERROR 500.
Please tell me what is the puncture?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Papa, 2015-04-06
Stifflera @PapaStifflera

var dzone = new Dropzone("#dropZed", {
   paramName: "img_url",
   url: "/admin/MyGallery/create"
   ......
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question