Ferbla
Ferbla

Reputation: 61

Laravel and Dropzonejs files not uploading

I have been working with Laravel and Dropzone JS so I can have a drag and drop file upload feature but it isn't seeming to want to upload.

This is my blade.php file, starting the form and it displays how I want it, but I think my issues are in the action tag.

<form class="dropzone" id="images-dropzone" method="post" action="{{ url('/upload') }}"></form>

Then in my routes file I have a very simple setup to catch it, but it does not seem to ever get here.

Route::post('/upload', function(){
    $file = Input::file('file');
    $directory = 'uploads/test/';
    $upload_success = Input::file('file')->move($directory, $file);
});

Upvotes: 0

Views: 1052

Answers (2)

muya_
muya_

Reputation: 1008

In addition to setting the enctype, check that upload_max_filesize in the PHP config allows the size of the file you are uploading. If you upload a larger file, it won't even show up if you log $request->all()

Suggestion from this thread: https://github.com/laravel/framework/issues/485#issuecomment-44801310

Upvotes: 0

KyleK
KyleK

Reputation: 5056

Missing enctype="multipart/form-data" in the form I think.

<form enctype="multipart/form-data" class="dropzone" id="images-dropzone" method="post" action="{{ url('/upload') }}"></form>

Upvotes: 3

Related Questions