警告:fopen():php中的文件名不能为空

i have a site through which user get video through passing url in field and have save video or download or embed in his play list

i am trying to download video through url and facing this problem

file_put_contents("video/".str_replace(" ","-",$name_vid.".mp4"), fopen($download_url, 'r'));

Warning: fopen(): Filename cannot be empty in D:\xampp\htdocs\Website\user_get_url_video_check.php on line 382

It might help to take all the code from the call to 'file_put_contents()' and break it up into a few lines.

For example, change: "video/".str_replace(" ","-",$name_vid.".mp4")

To: $video_name = str_replace(" ","-",$name_vid.".mp4"); $path_name = "video/".$video_name;

Then you can start debugging using 'var_dump($video_name)' or 'var_dump($path_name)' to make sure you're getting the expected results before calling file_put_contents(), where it will be harder to debug.