Laravel - Update Content Error Symfony Component HttpKernel Exception MethodNotAllowedHttpException












0















Hello I have an error here saying:




Symfony Component HttpKernel Exception MethodNotAllowedHttpException
No message




when I update the content. I have a one image and one view to update.



Below is my view. There is where the content is coded. I have the submit button here which will trigger the update. and the form @update.



admin/airlineplus/paxsafety.blade.php





    {!! Form::open(['action'=>['AdminPaxSafetyController@update', $paxsafe->id], 'method' => 'POST','enctype'=>'multipart/form-data']) !!}
<div class="form-group">
<div class="table-responsive">
<table class="table table-bordered">

<tr>
<th>Upload new Image and Video</th>

<td> {{ Form::file('paxsafety_image') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_image }}&nbsp;&nbsp; </strong> </td>

<td> {{ Form::file('paxsafety_video') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_video }}&nbsp;&nbsp; </strong></td>


</td>
</tr>
</table><br><br>
{{Form::submit('submit', ['class'=>'btn btn-primary', 'name'=>'submit'])}}
</div>
</div>
{!! Form::close() !!}


Next, my controller.



MyCoolController.php





  $this->validate($request, [
'paxsafety_image' => 'required',
'paxsafety_video' => 'required'
]);

if ($request->has('paxsafety_image') && $request->has('paxsafety_video'))
{
//Handle File Upload

$paxSafety = ;
foreach ($request->file('paxsafety_image') as $key => $file)
{
// Get FileName
$filenameWithExt = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt, PATHINFO_FILENAME);
//Get just extension
$extension = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore = $filename.'_'.time().'.'.$extension;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore);
array_push($paxSafety, $fileNameToStore);
}


$paxSafetyVideo = ;
foreach ($request->file('paxsafety_video') as $key => $file)
{
// Get FileName
$filenameWithExt2 = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt2, PATHINFO_FILENAME);
//Get just extension
$extension2 = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore2 = $filename.'_'.time().'.'.$extension2;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore2);
array_push($paxSafetyVideo, $fileNameToStore2);
}


$fileNameToStore = serialize($paxSafety);
$fileNameToStore2 = serialize($paxSafetyVideo);
}


foreach ($paxSafety as $key => $value) {
foreach ($paxSafetyVideo as $key => $values) {
$paxsafe = PaxSafety::find($id);
if($request->hasFile('paxsafety_image')){
$paxsafe->paxsafety_image = $value;
}
if($request->hasFile('paxsafety_video')){
$paxsafe->paxsafety_video = $values;
}
$paxsafe->save();
}
}
return redirect('/admin/airlineplus/paxsafety')->with('success', 'Inflight Magazine Content Inserted');


Guide me pls im new to coding in Laravel










share|improve this question




















  • 1





    you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

    – ADyson
    Nov 23 '18 at 0:06






  • 1





    Hi Summer Can you please post your route that points to the Method for processing this?

    – Josh
    Nov 23 '18 at 0:07











  • Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

    – user10665294
    Nov 23 '18 at 0:08











  • It works on insert ... but when I update it the error occurs

    – user10665294
    Nov 23 '18 at 0:09






  • 1





    I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

    – user10665294
    Nov 23 '18 at 0:23
















0















Hello I have an error here saying:




Symfony Component HttpKernel Exception MethodNotAllowedHttpException
No message




when I update the content. I have a one image and one view to update.



Below is my view. There is where the content is coded. I have the submit button here which will trigger the update. and the form @update.



admin/airlineplus/paxsafety.blade.php





    {!! Form::open(['action'=>['AdminPaxSafetyController@update', $paxsafe->id], 'method' => 'POST','enctype'=>'multipart/form-data']) !!}
<div class="form-group">
<div class="table-responsive">
<table class="table table-bordered">

<tr>
<th>Upload new Image and Video</th>

<td> {{ Form::file('paxsafety_image') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_image }}&nbsp;&nbsp; </strong> </td>

<td> {{ Form::file('paxsafety_video') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_video }}&nbsp;&nbsp; </strong></td>


</td>
</tr>
</table><br><br>
{{Form::submit('submit', ['class'=>'btn btn-primary', 'name'=>'submit'])}}
</div>
</div>
{!! Form::close() !!}


Next, my controller.



MyCoolController.php





  $this->validate($request, [
'paxsafety_image' => 'required',
'paxsafety_video' => 'required'
]);

if ($request->has('paxsafety_image') && $request->has('paxsafety_video'))
{
//Handle File Upload

$paxSafety = ;
foreach ($request->file('paxsafety_image') as $key => $file)
{
// Get FileName
$filenameWithExt = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt, PATHINFO_FILENAME);
//Get just extension
$extension = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore = $filename.'_'.time().'.'.$extension;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore);
array_push($paxSafety, $fileNameToStore);
}


$paxSafetyVideo = ;
foreach ($request->file('paxsafety_video') as $key => $file)
{
// Get FileName
$filenameWithExt2 = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt2, PATHINFO_FILENAME);
//Get just extension
$extension2 = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore2 = $filename.'_'.time().'.'.$extension2;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore2);
array_push($paxSafetyVideo, $fileNameToStore2);
}


$fileNameToStore = serialize($paxSafety);
$fileNameToStore2 = serialize($paxSafetyVideo);
}


foreach ($paxSafety as $key => $value) {
foreach ($paxSafetyVideo as $key => $values) {
$paxsafe = PaxSafety::find($id);
if($request->hasFile('paxsafety_image')){
$paxsafe->paxsafety_image = $value;
}
if($request->hasFile('paxsafety_video')){
$paxsafe->paxsafety_video = $values;
}
$paxsafe->save();
}
}
return redirect('/admin/airlineplus/paxsafety')->with('success', 'Inflight Magazine Content Inserted');


Guide me pls im new to coding in Laravel










share|improve this question




















  • 1





    you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

    – ADyson
    Nov 23 '18 at 0:06






  • 1





    Hi Summer Can you please post your route that points to the Method for processing this?

    – Josh
    Nov 23 '18 at 0:07











  • Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

    – user10665294
    Nov 23 '18 at 0:08











  • It works on insert ... but when I update it the error occurs

    – user10665294
    Nov 23 '18 at 0:09






  • 1





    I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

    – user10665294
    Nov 23 '18 at 0:23














0












0








0








Hello I have an error here saying:




Symfony Component HttpKernel Exception MethodNotAllowedHttpException
No message




when I update the content. I have a one image and one view to update.



Below is my view. There is where the content is coded. I have the submit button here which will trigger the update. and the form @update.



admin/airlineplus/paxsafety.blade.php





    {!! Form::open(['action'=>['AdminPaxSafetyController@update', $paxsafe->id], 'method' => 'POST','enctype'=>'multipart/form-data']) !!}
<div class="form-group">
<div class="table-responsive">
<table class="table table-bordered">

<tr>
<th>Upload new Image and Video</th>

<td> {{ Form::file('paxsafety_image') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_image }}&nbsp;&nbsp; </strong> </td>

<td> {{ Form::file('paxsafety_video') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_video }}&nbsp;&nbsp; </strong></td>


</td>
</tr>
</table><br><br>
{{Form::submit('submit', ['class'=>'btn btn-primary', 'name'=>'submit'])}}
</div>
</div>
{!! Form::close() !!}


Next, my controller.



MyCoolController.php





  $this->validate($request, [
'paxsafety_image' => 'required',
'paxsafety_video' => 'required'
]);

if ($request->has('paxsafety_image') && $request->has('paxsafety_video'))
{
//Handle File Upload

$paxSafety = ;
foreach ($request->file('paxsafety_image') as $key => $file)
{
// Get FileName
$filenameWithExt = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt, PATHINFO_FILENAME);
//Get just extension
$extension = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore = $filename.'_'.time().'.'.$extension;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore);
array_push($paxSafety, $fileNameToStore);
}


$paxSafetyVideo = ;
foreach ($request->file('paxsafety_video') as $key => $file)
{
// Get FileName
$filenameWithExt2 = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt2, PATHINFO_FILENAME);
//Get just extension
$extension2 = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore2 = $filename.'_'.time().'.'.$extension2;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore2);
array_push($paxSafetyVideo, $fileNameToStore2);
}


$fileNameToStore = serialize($paxSafety);
$fileNameToStore2 = serialize($paxSafetyVideo);
}


foreach ($paxSafety as $key => $value) {
foreach ($paxSafetyVideo as $key => $values) {
$paxsafe = PaxSafety::find($id);
if($request->hasFile('paxsafety_image')){
$paxsafe->paxsafety_image = $value;
}
if($request->hasFile('paxsafety_video')){
$paxsafe->paxsafety_video = $values;
}
$paxsafe->save();
}
}
return redirect('/admin/airlineplus/paxsafety')->with('success', 'Inflight Magazine Content Inserted');


Guide me pls im new to coding in Laravel










share|improve this question
















Hello I have an error here saying:




Symfony Component HttpKernel Exception MethodNotAllowedHttpException
No message




when I update the content. I have a one image and one view to update.



Below is my view. There is where the content is coded. I have the submit button here which will trigger the update. and the form @update.



admin/airlineplus/paxsafety.blade.php





    {!! Form::open(['action'=>['AdminPaxSafetyController@update', $paxsafe->id], 'method' => 'POST','enctype'=>'multipart/form-data']) !!}
<div class="form-group">
<div class="table-responsive">
<table class="table table-bordered">

<tr>
<th>Upload new Image and Video</th>

<td> {{ Form::file('paxsafety_image') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_image }}&nbsp;&nbsp; </strong> </td>

<td> {{ Form::file('paxsafety_video') }} &nbsp;&nbsp; <strong>{{ $paxsafe->paxsafety_video }}&nbsp;&nbsp; </strong></td>


</td>
</tr>
</table><br><br>
{{Form::submit('submit', ['class'=>'btn btn-primary', 'name'=>'submit'])}}
</div>
</div>
{!! Form::close() !!}


Next, my controller.



MyCoolController.php





  $this->validate($request, [
'paxsafety_image' => 'required',
'paxsafety_video' => 'required'
]);

if ($request->has('paxsafety_image') && $request->has('paxsafety_video'))
{
//Handle File Upload

$paxSafety = ;
foreach ($request->file('paxsafety_image') as $key => $file)
{
// Get FileName
$filenameWithExt = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt, PATHINFO_FILENAME);
//Get just extension
$extension = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore = $filename.'_'.time().'.'.$extension;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore);
array_push($paxSafety, $fileNameToStore);
}


$paxSafetyVideo = ;
foreach ($request->file('paxsafety_video') as $key => $file)
{
// Get FileName
$filenameWithExt2 = $file->getClientOriginalName();
//Get just filename
$filename = pathinfo( $filenameWithExt2, PATHINFO_FILENAME);
//Get just extension
$extension2 = $file->getClientOriginalExtension();
//Filename to Store
$fileNameToStore2 = $filename.'_'.time().'.'.$extension2;
//Upload Image
$path = $file->storeAs('public/paxsafety_folder',$fileNameToStore2);
array_push($paxSafetyVideo, $fileNameToStore2);
}


$fileNameToStore = serialize($paxSafety);
$fileNameToStore2 = serialize($paxSafetyVideo);
}


foreach ($paxSafety as $key => $value) {
foreach ($paxSafetyVideo as $key => $values) {
$paxsafe = PaxSafety::find($id);
if($request->hasFile('paxsafety_image')){
$paxsafe->paxsafety_image = $value;
}
if($request->hasFile('paxsafety_video')){
$paxsafe->paxsafety_video = $values;
}
$paxsafe->save();
}
}
return redirect('/admin/airlineplus/paxsafety')->with('success', 'Inflight Magazine Content Inserted');


Guide me pls im new to coding in Laravel







php mysql arrays laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 0:45









HCK

3,64711338




3,64711338










asked Nov 23 '18 at 0:02







user10665294















  • 1





    you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

    – ADyson
    Nov 23 '18 at 0:06






  • 1





    Hi Summer Can you please post your route that points to the Method for processing this?

    – Josh
    Nov 23 '18 at 0:07











  • Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

    – user10665294
    Nov 23 '18 at 0:08











  • It works on insert ... but when I update it the error occurs

    – user10665294
    Nov 23 '18 at 0:09






  • 1





    I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

    – user10665294
    Nov 23 '18 at 0:23














  • 1





    you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

    – ADyson
    Nov 23 '18 at 0:06






  • 1





    Hi Summer Can you please post your route that points to the Method for processing this?

    – Josh
    Nov 23 '18 at 0:07











  • Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

    – user10665294
    Nov 23 '18 at 0:08











  • It works on insert ... but when I update it the error occurs

    – user10665294
    Nov 23 '18 at 0:09






  • 1





    I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

    – user10665294
    Nov 23 '18 at 0:23








1




1





you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

– ADyson
Nov 23 '18 at 0:06





you seem to have missed out the start of the controller code? Anyway a "Method not allowed" exception in HTTP means that the HTTP method you used to make the request is not permitted by the server to be used at the URL you sent it to. e.g. your form submits using the HTTP "POST" method, but perhaps you didn't set your action method up to accept POST requests. Maybe it only accepts GET or something.

– ADyson
Nov 23 '18 at 0:06




1




1





Hi Summer Can you please post your route that points to the Method for processing this?

– Josh
Nov 23 '18 at 0:07





Hi Summer Can you please post your route that points to the Method for processing this?

– Josh
Nov 23 '18 at 0:07













Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

– user10665294
Nov 23 '18 at 0:08





Hi @Josh here is my route Route::resource('/admin/airlineplus/paxsafety', 'AdminPaxSafetyController');

– user10665294
Nov 23 '18 at 0:08













It works on insert ... but when I update it the error occurs

– user10665294
Nov 23 '18 at 0:09





It works on insert ... but when I update it the error occurs

– user10665294
Nov 23 '18 at 0:09




1




1





I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

– user10665294
Nov 23 '18 at 0:23





I've solved the problem..I forgot to put csrf or PUT method above the submit button :;) LOL thank you for the HTTP

– user10665294
Nov 23 '18 at 0:23












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439262%2flaravel-update-content-error-symfony-component-httpkernel-exception-me%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439262%2flaravel-update-content-error-symfony-component-httpkernel-exception-me%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Xamarin.form Move up view when keyboard appear

JBPM : POST request for execute process go wrong