ThinkPHP5.0多個(gè)文件上傳后找不到臨時(shí)文件的修改方法
這是修改之前的代碼
if(!empty($_FILES)){ if(!empty($_FILES['org_positive'])){ $org_positive = request()->file('org_positive'); if($org_positive){ $info = $org_positive->move(ROOT_PATH . 'uploads'); $positive_path="/uploads/".$info->getSaveName(); }else{ $positive_path=""; } } if(!empty($_FILES['org_reverse'])){ $org_reverse = request()->file('org_reverse'); if($org_reverse){ $info1=$org_reverse->move(ROOT_PATH . 'uploads'); $reverse_path="/uploads/".$info1->getSaveName(); }else{ $reverse_path=""; } } if(!empty($_FILES['org_license'])){ $org_license = request()->file('org_license'); if($org_license){ $info2=$org_license->move(ROOT_PATH . 'uploads'); $license_path="/uploads/".$info2->getSaveName(); }else{ $license_path=""; } } }
在處理$_FILES第二個(gè)元素的時(shí)候出現(xiàn)了以下錯(cuò)誤
這是改良之后的代碼
if(!empty($_FILES)){ if(!empty($_FILES['org_positive'])){ $org_positive = request()->file('org_positive'); } if(!empty($_FILES['org_reverse'])){ $org_reverse = request()->file('org_reverse'); } if(!empty($_FILES['org_license'])){ $org_license = request()->file('org_license'); } if($org_positive){ $info = $org_positive->move(ROOT_PATH . 'uploads'); $positive_path="/uploads/".$info->getSaveName(); }else{ $positive_path=""; } if($org_reverse){ $info1=$org_reverse->move(ROOT_PATH . 'uploads'); $reverse_path="/uploads/".$info1->getSaveName(); }else{ $reverse_path=""; } if($org_license){ $info2=$org_license->move(ROOT_PATH . 'uploads'); $license_path="/uploads/".$info2->getSaveName(); }else{ $license_path=""; } }
本人是小白,在網(wǎng)上查找到資料說(shuō)php上傳文件后較短時(shí)間會(huì)刪除臨時(shí)文件,也就是$_FILES[‘file'][‘tmp_name']
這個(gè)值,修改代碼之后沒(méi)有報(bào)錯(cuò)了,成功將臨時(shí)文件轉(zhuǎn)移了出來(lái)
總結(jié)
以上所述是小編給大家介紹的ThinkPHP5.0多個(gè)文件上傳后找不到臨時(shí)文件的修改方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
php在windows環(huán)境下獲得cpu內(nèi)存實(shí)時(shí)使用率(推薦)
這篇文章主要介紹了php在windows環(huán)境下獲得 cpu 內(nèi)存實(shí)時(shí)使用率的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2018-02-02Laravel 實(shí)現(xiàn)在Blade模版中使用全局變量代替路徑的例子
今天小編就為大家分享一篇Laravel 實(shí)現(xiàn)在Blade模版中使用全局變量代替路徑的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10PHP分頁(yè)初探 一個(gè)最簡(jiǎn)單的PHP分頁(yè)代碼的簡(jiǎn)單實(shí)現(xiàn)
下面小編就為大家?guī)?lái)一篇PHP分頁(yè)初探 一個(gè)最簡(jiǎn)單的PHP分頁(yè)代碼的簡(jiǎn)單實(shí)現(xiàn)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-06-06php中單個(gè)數(shù)據(jù)庫(kù)字段多列顯示(單字段分頁(yè)、橫向輸出)
這篇文章主要介紹了php中單個(gè)數(shù)據(jù)庫(kù)字段多列顯示、分行分列顯示技巧,也可稱為單字段分頁(yè)、橫向輸出,需要的朋友可以參考下2014-07-07