ThinkPHP5.0多個文件上傳后找不到臨時文件的修改方法
這是修改之前的代碼
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第二個元素的時候出現(xiàn)了以下錯誤
這是改良之后的代碼
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)上查找到資料說php上傳文件后較短時間會刪除臨時文件,也就是$_FILES[‘file'][‘tmp_name']這個值,修改代碼之后沒有報錯了,成功將臨時文件轉(zhuǎn)移了出來
總結(jié)
以上所述是小編給大家介紹的ThinkPHP5.0多個文件上傳后找不到臨時文件的修改方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
thinkphp5.1框架中容器(Container)和門面(Facade)的實現(xiàn)方法分析
這篇文章主要介紹了thinkphp5.1框架中容器(Container)和門面(Facade)的實現(xiàn)方法,結(jié)合實例形式分析了thinkPHP5.1框架中容器與門面的定義、實現(xiàn)方法及相關(guān)操作注意事項,需要的朋友可以參考下2019-08-08
Laravel框架中VerifyCsrfToken報錯問題的解決
這篇文章主要給大家介紹了關(guān)于Laravel框架中VerifyCsrfToken報錯問題的解決方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習,需要的朋友們下面跟著小編來一起學習學習吧。2017-08-08
Laravel5.4框架使用socialite實現(xiàn)github登錄的方法
這篇文章主要介紹了Laravel5.4框架使用socialite實現(xiàn)github登錄的方法,結(jié)合實例形式分析了Laravel相關(guān)下載、安裝、配置及github登陸、注冊、設(shè)置等相關(guān)操作技巧,需要的朋友可以參考下2019-03-03
php實現(xiàn)屏蔽掉黑帽SEO的搜索關(guān)鍵字
這篇文章主要介紹了php實現(xiàn)屏蔽掉黑帽SEO的搜索關(guān)鍵字的相關(guān)資料,這里推薦給大家,有需要的小伙伴可以參考下。2015-04-04

