mercredi 17 avril 2019

How can I retrieve file from external url?

I am trying to develop a small app that enables a user to upload video from URL or user can directly upload video from his/her device. For instance if a user gives a link of a youtube video this should be stored at my storage folder or user can upload video from his Computer drive/ phone storage.

I have completed the upload from device/storage. But unable to do that from external url

    $request->validate([
        'video' => 'required',
        'title' => 'required'
    ]);

    if ($request->hasFile('video')) {
        $path = Storage::disk('public')->put('videos', $request->file('video'));
        Video::create([
                'title' => $request->get('title'),
                'video' => $path,
                'user_id' => Auth::user()->id
        ]);

    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire