ajax method not allowed,php - Laravel AJAX request, Method not allowed - Stack Overflow

作者在使用blueimp jQuery File Upload上传图片时遇到问题,从创建成员页面正常工作到编辑成员时返回405 Method Not Allowed。已排除路由和URL匹配问题,求助于是否有人遇到过类似在admin/members/1/edit场景下的上传问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 that is outside the

tags because it is independent to the form:

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 example.app/admin/members/create it works, but when i'm trying to access it from example.app/admin/members/1/edit i get a 405, Method not allowed.

In both cases, the Method is POST.

My routes for create and edit URIs:

Route::get('members/create', [

'uses' => 'MembersController@create', 'as' => 'admin/members/create'

]);

Route::get('members/{member}/edit', [

'uses' => 'MembersController@edit', 'as' => 'admin/members/edit'

]);

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!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值