[ANSWERED] php – Laravel does not upload video file and store tmp filename in database

Solution : 1 :

edit: previous answer about version of aws-sdk-php was not right.

Problem :

I’m working with Laravel 5.8 and I wanted to upload a video file.

So in the Controller, I added this code which does the uploading:

if ($request->file('prd_video')) {
    $video = Request::file('prd_video');
    $videoname = $video->getClientOriginalName();
    $path = public_path().'/upload/video/products/';
    $request->file('prd_video')->move($path, $videoname);
            
    $findpro = Product::find($stored->prd_id);
    $findpro->prd_video = $videoname;
    $findpro->save();
}

Now when I test this, after minutes of loading, the file does not uploaded and store a name like /tmp/phpsMPjG1 as filename in the database.

Also there is no error appearing and the process of insertion seems to be completed successfully.

So what’s going wrong here? How can I solve this issue?

Problem :

I’m working with Laravel 5.8 and I wanted to upload a video file.

So in the Controller, I added this code which does the uploading:

if ($request->file('prd_video')) {
    $video = Request::file('prd_video');
    $videoname = $video->getClientOriginalName();
    $path = public_path().'/upload/video/products/';
    $request->file('prd_video')->move($path, $videoname);
            
    $findpro = Product::find($stored->prd_id);
    $findpro->prd_video = $videoname;
    $findpro->save();
}

Now when I test this, after minutes of loading, the file does not uploaded and store a name like /tmp/phpsMPjG1 as filename in the database.

Also there is no error appearing and the process of insertion seems to be completed successfully.

So what’s going wrong here? How can I solve this issue?

Comments

Comment posted by Aqib Javed

try “$file->move($path, $videoname);” instead of “$request->file(‘prd_video’)->move($path, $videoname);”

READ  [ANSWERED] javascript - Filling up one dropdown with same value of the other
Author:

Leave a Reply

Your email address will not be published. Required fields are marked *