JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<title>Multiple File Upload using Ajax, Jquery and PHP</title>
<link href="http://localhost/uploads_test/css/bootstrap.css" rel="stylesheet" type="text/css" media="screen">
<link rel="stylesheet" type="text/css" href="http://localhost/uploads_test/css/DT_bootstrap.css">
</head>
<script src="http://localhost/uploads_test/js/jquery.js" type="text/javascript"></script>
<script src="http://localhost/uploads_test/js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="http://localhost/uploads_test/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="http://localhost/uploads_test/js/DT_bootstrap.js"></script>
<script type="text/javascript" src="http://localhost/uploads_test/js/jquery_1.5.2.js"></script>
<body>
<center>
<h2 style="color:blue; text-align:center;">Multiple Files Upload</h2>
<form name="form_id" id="form_id" action="javascript:void(0);" enctype="multipart/form-data" style="width:800px; margin-top:20px;">
<div class="row">
<div class="col-lg-12">
<label class="fieldlabels">Documentation:</label> <br>
<input type="file" name="vasplus_multiple_files" id="vasplus_multiple_files" accept="application/pdf" multiple="multiple"/><br>
<!--input type="submit" value="Upload" /--><br>
<table class="table table-striped table-bordered" style="width:60%;" id="add_files">
<thead>
<tr>
<th style="color:blue; text-align:center;">File Name</th>
<th style="color:blue; text-align:center;">Status</th>
<th style="color:blue; text-align:center;">File Size</th>
<th style="color:blue; text-align:center;">Action</th>
<tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="row">
<div...
CSS
<style>
body {
font-family:Verdana, Geneva, sans-serif;
}
span{
color:red;
cursor:pointer;
}
</style>
JavaScript
<script>
function vpb_multiple_file_uploader(vpb_configuration_settings)
{
this.vpb_settings = vpb_configuration_settings;
this.vpb_files = "";
this.vpb_browsed_files = []
var self = this;
var vpb_msg = "Sorry, your browser does not support this application. Thank You!";
//Get all browsed file extensions
function vpb_file_ext(file) {
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/* Display added files which are ready for upload */
//with their file types, names, size, date last modified along with an option to remove an unwanted file
vpb_multiple_file_uploader.prototype.vpb_show_added_files = function(vpb_value)
{
this.vpb_files = vpb_value;
if(this.vpb_files.length > 0)
{
var vpb_added_files_displayer = vpb_file_id = "";
for(var i = 0; i<this.vpb_files.length; i++)
{
//Use the names of the files without their extensions as their ids
var files_name_without_extensions = this.vpb_files[i].name.substr(0, this.vpb_files[i].name.lastIndexOf('.')) || this.vpb_files[i].name;
vpb_file_id = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_file_to_add = vpb_file_ext(this.vpb_files[i].name);
var vpb_class = $("#added_class").val();
var vpb_file_icon;
//Check and display File Size
var vpb_fileSize = (this.vpb_files[i].size / 1024);
if (vpb_fileSize / 1024 > 1)
{
if (((vpb_fileSize / 1024) / 1024) > 1)
{
vpb_fileSize = (Math.round(((vpb_fileSize / 1024) / 1024) * 100) / 100);
var vpb_actual_fileSize = vpb_fileSize + " GB";
}
else
{
...