У меня есть форма, где я включил dropzone.js. Плагин его работу до просмотра изображения, после того, как я получаю сообщение об ошибке POST: 500 (Internal Server Error)
на dropzone.js:1386
Ошибка с POST ajax во время загрузки изображения с dropzone
Dropzone.prototype.submitRequest = function(xhr, formData, files) {
return xhr.send(formData);<--here
};
Мое мнение:
Dropzone.options.images = false;
\t $("#images").dropzone({
\t url: "{{url('/')}}/ajax-uploadvehicleimage",
\t paramName: "file",
\t maxFiles: 10,
maxfilesexceeded: function(file) {
this.removeFile(file);
\t alert('you no have more picture avaible! Pay for more here');
},
error: function(file, response) {
if($.type(response) === "string")
var message = response; //dropzone sends it's own error messages in string
else
var message = response.message;
file.previewElement.classList.add("dz-error");
_ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
_results.push(node.textContent = message);
}
return _results;
},
success: function(file,done) {
alert(done);
}
});
<div id="images" class="dropzone">
\t </div>
Маршрут:
Route::post('/ajax-uploadvehicleimage','[email protected]');
Th e:
public function uploadimg(){
if (Request::hasFile('file'))
{
//houston we have a file!
$file = Request::file('file');
//move it to our public folder and rename it to $name
Request::file('file')->move('images', 'insert_file_name.'.$file->getClientOriginalExtension());
echo 'file uploaded!';
var_dump($file);
}else{
echo 'no file, no bueno';
}
}
Может объяснить мне, в чем проблема, и как я могу изменить его или образец? Я читал много тем об этом, но никто не был выпущен!
EDIT: Laravel.log:
[2017-01-13 07:55:38] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Can't use function return value in write context' in E:\bitnami\apache2\htdocs\vehicle\app\Http\Controllers\VehicleAddController.php:103
Stack trace:
#0 {main}
Что он скажет в вашем файле журнала Laravel? Там должна быть трассировка стека. Если нет, включите отладку приложения. – Erin
@ Ерин добавил журнал –
Просто вне интереса, какая версия php работает? – rchatburn