国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Beim Datei-Upload-Vorgang in Laravel5.1 ist ein Fehler aufgetreten
為情所困
為情所困 2017-05-16 16:53:51
0
2
766


Das Folgende ist der Code (ich würde gerne fragen, wie man ihn ?ndert. Ich bin ein Anf?nger, vielen Dank im Voraus!):
<?php

Namespace AppHttpControllers;

verwenden Sie IlluminateHttpRequest;

AppHttpRequests verwenden;

class RequestController erweitert Controller
{

public function getFileupload(){
    $postUrl='/laravelFirst/public/index.php/request/fileupload';
    $csrf_field=csrf_field();
    $html=<<<FILE
    <form action="$postUrl" method="post" enctype="multipart/form-data">
    $csrf_field
    <input type="file" name="file"><br/>
    <input type="submit" value="提交">
    </form>

DATEI;

    return $html;          
}
public function postFileupload(Request $request){
    if(!$request->hasFile('file')){
        exit('上傳文件為空!');
    }
    $file=$request->file('file');
    if(!$file->isValid()){
        exit('上傳文件出錯(cuò)!');
    }
    $destPath = realpath(public_path('images'));
    if(!file_exists($destPath)){
    mkdir($destPath,0755,true);
}
    $filename=$file->getClientOriginalName();
    if(!$file->move($destPath,$filename)){
        exit('保存文件失??!');
    }
    exit('文件上傳成功!');
}

}

為情所困
為情所困

Antworte allen(2)
過去多啦不再A夢(mèng)

你打印那個(gè)destPath看看

習(xí)慣沉默

laravel上傳文件還是使用Storage這個(gè)Facade吧,他可以自己處理文件夾創(chuàng)建之類的問題

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage