“Faça o upload do arquivo Laravel” Respostas de código

Faça o upload do arquivo Laravel


    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

upload de arquivo de laravel

<?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

Arquivo da loja Laravel

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

uploads de arquivo de laravel

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

Respostas semelhantes a “Faça o upload do arquivo Laravel”

Perguntas semelhantes a “Faça o upload do arquivo Laravel”

Mais respostas relacionadas para “Faça o upload do arquivo Laravel” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código