Environment:php+dropzone.js+CI(codeigniter)
Server can not execute uploading.But browser console can output info.
<div class="panel-body">
<div class="form-group">
<label class="control-label">File Upload</label>
<div class="controls">
<form action="Upload/do_upfile" class="dropzone" id="myDropzone">
<div class="fallback">
<input name="userfile" type="file" multiple="" />
</div>
</form>
</div>
</div>
script:
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("#myDropzone", {
url: "Upload/do_upfile",
method: 'post',
addRemoveLinks: true,
uploadMultiple: true,
init: function() {
this.on("addedfile", function(file) {
console.log("File " + file.name + "add");
});
this.on("success", function(file) {
console.log("File " + file.name + "uploaded");
});
this.on("removedfile", function(file) {
console.log("File " + file.name + "removed");
});
}
});
php ci controllers
public function do_upfile()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|css';
//$config['max_size'] = 100000;
//$config['max_width'] = 1024;
//$config['max_height'] = 768;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
Browsers, upload is normal, the console input also has content, but not execute on the server, ths!