Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

Multiple file upload in php

php ajax codeigniter laravel
Multiple file upload in php

Sometimes we need to allow our users to upload multiple file upload. Today I am going to show you how to allow users to upload multiple files. It is almost similar like simple file upload but we need to do some modification with html markup and php code. Now I am going to show you how to upload multiple file with PHP and basic HTML form. You may also like Multiple file upload in Codeigniter and Multiple Image Upload in PHP.

PHP Code

for($i=0; $i<count($_FILES['file']['name']); $i++) {

    $tmpFilePath = $_FILES['file']['tmp_name'][$i];
    $shortname = $_FILES['file']['name'][$i];
    $filename = date('YmdHis').$_FILES['file']['name'][$i];
    $filePath = "./public/course_work/".$filename;
    $ext = pathinfo($_FILES['file']['name'][$i], PATHINFO_EXTENSION);

    $file = basename($shortname,".".$ext);

    if(move_uploaded_file($tmpFilePath, $filePath))


Html code work in comment box

Related Post