“Laravel -Datei Upload” Code-Antworten

Datei Laravel hochladen


    public function fileUploadPost(Request $request)

    {

        $request->validate([

            'file' => 'required|mimes:pdf,xlx,csv|max:2048',

        ]);

  

        $fileName = time().'.'.$request->file->extension();  

   

        $request->file->move(public_path('uploads'), $fileName);

   

        return back()

            ->with('success','You have successfully upload file.')

            ->with('file',$fileName);

   

    }
kashi knight

Laravel -Datei Upload

<?php

   

namespace App\Http\Controllers;

  

use Illuminate\Http\Request;

  

class FileUploadController extends Controller

{

    /**

     * Display a listing of the resource.

     *

     * @return \Illuminate\Http\Response

     */

    public function fileUpload()

    {

        return view('fileUpload');

    }

  

    /**

     * Display a listing of the resource.

     *

     * @return \Illuminate\Http\Response

     */

    public function fileUploadPost(Request $request)

    {

        $request->validate([

            'file' => 'required|mimes:pdf,xlx,csv|max:2048',

        ]);

  

        $fileName = time().'.'.$request->file->extension();  

   

        $request->file->move(public_path('uploads'), $fileName);

   

        return back()

            ->with('success','You have successfully upload file.')

            ->with('file',$fileName);

   

    }

}
Nice Nightingale

Laravel Store -Datei

$path = $request->file('avatar')->store(
    'avatars', 'public'
);
Faithful Fox

Laravel -Datei Uploads

$path = Storage::putFile('avatars', $request->file('avatar'));
Crazy Copperhead

Ähnliche Antworten wie “Laravel -Datei Upload”

Fragen ähnlich wie “Laravel -Datei Upload”

Weitere verwandte Antworten zu “Laravel -Datei Upload” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen