<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                上傳的配置文件`/config/filesystems.php`,上傳的目錄可配置也可不配置, 上傳的目錄的可在保存文件的同時寫上 ``` 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], //這是新增的保存目錄 'uploads' => [ 'driver' => 'local', 'root' => storage_path('app/uploads'), 'url' => env('APP_URL').'/storage', //'visibility' => 'uploads', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), ], ], ``` ***** 1.html文件 ``` <form class="form-horizontal" method="POST" action="" enctype="multipart/form-data"> {{ csrf_field() }} <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> <label for="password" class="col-md-4 control-label">請選擇文件</label> <div class="col-md-6"> <input id="file" type="file" class="form-control" name="source" required> @if ($errors->has('password')) <span class="help-block"> <strong>{{ $errors->first('password') }}</strong> </span> @endif </div> </div> <div class="form-group"> <div class="col-md-8 col-md-offset-4"> <button type="submit" class="btn btn-primary"> 確認上傳 </button> </div> </div> </form> ``` ***** 2.php代碼 ``` if($request->isMethod('post')){ $file = $request->file('source'); if($file->isValid()){ //原文件名 $originalName = $file->getClientOriginalName(); //擴展名 $ext = $file->getClientOriginalExtension(); //MimeType $type = $file->getClientMimeType(); //臨時絕對路徑 $realPath = $file->getRealPath(); //第一種存儲方式 //文件名laravel自動生成 //$path = $file->store('uploads'); //自行生成文件名 //$path = $file->storeAs('uploads','55544.'.$ext); //第二種存儲方式 $fileName=date('Y-m-d-H-i-s').'-'.uniqid().'.'.$ext; $path = Storage::putFile('uploads', $file); //$bool=Storage::disk('uploads')->put($fileName,file_get_contents($realPath)); //var_dump($bool); var_dump($path); } //dd($file); //exit(); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看