vendredi 2 octobre 2015

Laravel AJAX request, Method not allowed

I have a problem when trying to upload an image via bluimp's jQueryFileUpload.

In my routes i have this: Route::post('image/upload/{folder}', 'ImageController@upload');

my file input:

<input id="imageupload" type="file" name="image" multiple="" data-url="{{ url('admin/image/upload/members') }}" >

my jQuery function points to the data-url attribute value.:

  $('#imageupload').fileupload({
        dataType: 'json',
        maxFileSize: 5000000,
        acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
        done: function (e, data) {
            Members.handle_image(data);
        }
   });

The weird thing is that when i call this method from http://ift.tt/1j4GGzL it works, but when i'm trying to access it from http://ift.tt/1MMHUcB i get a 405, Method not allowed.

In both cases, the Method is POST.

I'm sure is something really stupid that i can't see.

PS. I have a Project resource, where i also upload images, using the same route and function. It works on both cases (create and edit).

Anybody had this problem ?

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire