Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

TokenMismatchException in VerifyCsrfToken.php

Hello,

I am receiving this error message:

TokenMismatchException in VerifyCsrfToken.php line 53:

while trying to proses this codes:

SettingController.php

public function SendPicture(Request $request)
{

    $title = "Picture Purchase";
    $picture = $request->input('pic');

    $content = "Someone purchase your picture: $picture";
    
    
    Mail::send('soulfy.email.purchase', ['title' => $title, 'content' => $content], function ($message) use ($account)//use ($attach)
    {

        $message->from('davy.yg1@gmail.com', 'Admin');

        $message->to(['[email protected]',$account]);

        //Attach file
        //$message->attach($attach);

        //Add a subject
        $message->subject("Picture Purchase");

    });

    return redirect('home/setting');

}

setting.blade.php

 <form action="{{ action('SettingController@SendPicture') }}" method="post">
                                    {{ csrf_field() }}  
                                    
                                    <table>
                                        @foreach ($themes->chunk(3) as $chunk)
                                            <tr>
                                            @foreach ($chunk as $theme)
                                                <td>
                                                    <img width="100px"
                                                        height="100px"
                                                        src="{{url('/')}}/uploads/theme/{{$theme->pic_name}}.jpg"/> 
                                                    <input type="checkbox" name="pic" value="{{$theme->pic_name}}"/>
                                                </td>
                                            @endforeach
                                            </tr>
                                        @endforeach
                                    </table>

                                    @if ( $themes->currentPage() != 1)
                                    <a href="{!! $themes->previousPageUrl() !!}"> << </a>@endif

                                    {!! $themes->currentPage() !!} of {!! $themes->lastPage() !!}

                                     @if ( $themes->currentPage() !=  $themes->lastPage())
                                    <a href="{!! $themes->nextPageUrl() !!}"> >> </a>@endif
                                            
                                                                            
                                    <input type="submit" value="Purchase">  
                                    </form>

Any clue why?

0 likes
1 reply
Snapey's avatar

maybe it has been more than two hours since you loaded the form?

Please or to participate in this conversation.