S
S
supercoder6662020-10-13 12:01:47
Laravel
supercoder666, 2020-10-13 12:01:47

How to get image path in Laravel?

Hello. I have such a problem. There is a code that saves the data from the form to the database:

public function NewpostSubmit(AdminpanelRequest $postData) {
        $newpost = new NewpostModel();
        $newpost->title = $postData->input('title');
        $newpost->thetext= $postData->input('thetext');
        // $coverpath = $postData->file('uploadPostCover')->store('uploads', 'public');
        // $newpost->coverpath = $postData->input($coverpath);
        $newpost->save();

The two lines that I commented out are responsible for processing the image upload form. The first line, in fact, loads the picture into a folder, and the second, in theory, should write the path to the picture in mysql, but this path is not recorded in the database. How can this be corrected? Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question