Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
850 views
in Technique[技术] by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...