SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value

  laravel, php, vue.js

i wanted to upload image using vue template in laravel i just create a simple code but i got this problem.. check my code below


<template>
  <dir class="composer">
  

      <input type="file" @change="sendFiles">
      <textarea v-model="message" @keydown.enter="send" placeholder="Message..."></textarea>
  </dir> 
</template>

<script>
export default {
    data() {
        return {
            message: '',
            files: []
        };
    },
    methods: {
     
        sendFiles(event) {
            this.files=event.target.files[0];
            console.log(this.files.name);

            axios.post('/conversation/imgsend', {
                image: this.files

enter code here

            }).then((response) => {
                console.log("send image") 
            })

            }

    }


}
----in my controller------
 public function imgsend(Request $request)
    {
        $message = Message::create([
            'image' => $request->image,
            'to' => 1,
            'text' => "dfsf",
            'from' => auth()->id()
            
            ]);
    }

—my web.php—-

Route::post('/conversation/imgsend', [MessagesController::class, 'imgsend']);

—-i got this problem ——
SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value

Source: Laravel

Leave a Reply