如何克隆TMP上传的文件?

I want to change text in my text.txt uploaded for each link, so I upload TEXT.TXT and that results in 3 text.txt in archive like

    $namefil_text = $_FILES["myfile_text"]["name"];
    $typefil_text = $_FILES["myfile_text"]["type"];
    $sizefil_text = $_FILES["myfile_text"]["size"];
    $tempfil_text = $_FILES["myfile_text"]["tmp_name"];
    $errorfil_text = $_FILES["myfile_text"]["error"];

    $fisi_text1 = file_put_contents($tempfil_text,str_replace('link_gsh',$video_link1,file_get_contents($tempfil_text)));
    $fisi_text2 = file_put_contents($tempfil_text,str_replace('link_gsh',$video_link2,file_get_contents($tempfil_text)));
    $fisi_text3 = file_put_contents($tempfil_text,str_replace('link_gsh',$video_link3,file_get_contents($tempfil_text)));



if ($zip1->open("./videos/".$numefiermare1, ZIPARCHIVE::CREATE)!==TRUE) {
                            exit("Cannot open <$numefiermare1>
");
                        }
                        else
                        {
                            $zip3->addFile($tempfil,$namefil);
                            $zip3->addFile($fisi_text1,$namefil_text);
                            $zip3->close();

}
if ($zip2->open("./videos/".$numefiermare2, ZIPARCHIVE::CREATE)!==TRUE) {
                            exit("Cannot open <$numefiermare1>
");
                        }
                        else
                        {
                            $zip3->addFile($tempfil,$namefil);
                            $zip3->addFile($fisi_text2,$namefil_text);
                            $zip3->close();

}
if ($zip3->open("./videos/".$numefiermare3, ZIPARCHIVE::CREATE)!==TRUE) {
                            exit("Cannot open <$numefiermare3>
");
                        }
                        else
                        {
                            $zip3->addFile($tempfil,$namefil);
                            $zip3->addFile($fisi_text3,$namefil_text);
                            $zip3->close();

}

So now comes the question... if I run the code like that only one archive gets the txt file OR do all of them get the text file with same link? As you can see, I try to replace that syntax with link from the form.

How can I fix that ? Thanks !

I haven't really understood what you're really asking, but in all else blocks, you're referencing $zip3 which will not be open in the first two cases. You need to use $zip1 and $zip2 in those else blocks instead. You should also format your code nicely: you will spot errors like these more easily in tidy code.