Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html multiple file upload

<form action="/action_page.php" enctype="multipart/form-data">
  <label for="images">Select images:</label>
  <input type="file" name="images[]" id="images" accept="image/*" multiple="multiple" id="product-photo-add">
  <input type="submit">
</form>
Comment

html multiple file upload

<form action="/action_page.php">
  <label for="files">Select files:</label>
  <input type="file" id="files" name="files" multiple><br><br>
  <input type="submit">
</form>
Comment

Multiple File Upload

<?php

  

namespace AppHttpControllers;

  

use IlluminateHttpRequest;

use AppModelsFile;

  

class FileController extends Controller

{

    /**

     * Display a listing of the resource.

     *

     * @return IlluminateHttpResponse

     */

    public function index()

    {

        return view('fileUpload');

    }

    

    /**

     * Display a listing of the resource.

     *

     * @return IlluminateHttpResponse

     */

    public function store(Request $request)

    {

        $request->validate([

            'files' => 'required',

            'files.*' => 'required|mimes:pdf,xlx,csv|max:2048',

        ]);

      

        $files = [];

        if ($request->file('files')){

            foreach($request->file('files') as $key => $file)

            {

                $fileName = time().rand(1,99).'.'.$file->extension();  

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

                $files[]['name'] = $fileName;

            }

        }

  

        foreach ($files as $key => $file) {

            File::create($file);

        }

     

        return back()

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

   

    }

}
Comment

Multiple File Upload

<?php

  

namespace AppHttpControllers;

  

use IlluminateHttpRequest;

use AppModelsFile;

  

class FileController extends Controller

{

    /**

     * Display a listing of the resource.

     *

     * @return IlluminateHttpResponse

     */

    public function index()

    {

        return view('fileUpload');

    }

    

    /**

     * Display a listing of the resource.

     *

     * @return IlluminateHttpResponse

     */

    public function store(Request $request)

    {

        $request->validate([

            'files' => 'required',

            'files.*' => 'required|mimes:pdf,xlx,csv|max:2048',

        ]);

      

        $files = [];

        if ($request->file('files')){

            foreach($request->file('files') as $key => $file)

            {

                $fileName = time().rand(1,99).'.'.$file->extension();  

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

                $files[]['name'] = $fileName;

            }

        }

  

        foreach ($files as $key => $file) {

            File::create($file);

        }

     

        return back()

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

   

    }

}
Comment

PREVIOUS NEXT
Code Example
Html :: start a video at a certain time and end time html 
Html :: highlight js 
Html :: view html file linux terminal 
Html :: change html div jquery 
Html :: submit button out of from 
Html :: how to change the color of text in marquee in html 
Html :: convert gene id to gene symbol in R 
Html :: html to xml 
Html :: what should i use for html 
Html :: how to defualt volume at 50% of video html 
Html :: html deactivate scrolling 
Html :: types of buttons in html 
Html :: html how to start a page 
Html :: image slider with bootstrap 
Html :: how to echo data into an option tag as a link 
Html :: input type tel 
Html :: creating a table in html 
Html :: link tag 
Html :: textboxfor required 
Html :: how to set a var in js to be a download 
Html :: vs code basic html template shortcut 
Html :: svelte pass arguments to function 
Html :: iphone disable zoom on select 
Html :: Simple example of using inline javascript in html 
Html :: lorem ipsum shortcut 
Html :: picture element html 
Html :: fontawesome icons reference 
Html :: phone number validation html 
Html :: email validator hmtl 
Html :: mysql data to html table 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =