亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

An error occurred in the file upload operation in laravel5.1
為情所困
為情所困 2017-05-16 16:53:51
0
2
763


The following is the code (I would like to ask how to modify it. I am a novice, thank you all in advance!):
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class RequestController extends 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>

FILE;

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

}

為情所困
為情所困

reply all(2)
過去多啦不再A夢

Print the destPath and take a look

習慣沉默

Laravel should use this Facade to upload files, it can handle issues such as folder creation by itselfStorage

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template