View source for Hack: Async Upload

#||
||
Compatible with: !!(green)**R6.1**!!
Current version: 0.4.beta
Credits:  ((user:WikiAdmin WikiAdmin))
|{{toc numerate=1}} ||
||#

##~{{upload}}##

**((file:async_upload_patch.zip async_upload_patch.zip))**
{{files}}

Put the files in the following folders:
#|
*| folder / file  |*
|| ##action/upload.php## ||
|| ##action/template/upload.tpl## ||
|| ##js/upload.js## ||
|| ##handler/page/upload.php## ||
|| ##handler/page/template/upload.tpl## ||
|#


===Documentation==
Action - module for bulk upload files on a WackoWiki site with a record in the database.

Features:
  1. uses Fetch API to upload (even large) files
  2. chose and upload multiple files at once

%%(hl javascript)
const url = 'handler/page/upload.php';
const form = document.querySelector('form');

form.addEventListener('submit', e => {
	e.preventDefault();

	const files = document.querySelector('[type=file]').files;
	const formData = new FormData();

	for (let i = 0; i < files.length; i++)
	{
		let file = files[i];

		formData.append('files[]', file);
	}

	fetch(url, {
		method: 'POST',
		body: formData
	}).then(response => {
		console.log(response);
	});
});
%%

Resources
  * ((https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Uploading_a_file Using Fetch: Uploading multiple files))

====Configuration====
  *  none so far
  * read the TODO comments in the files

====How to use it====
- same as current upload action

Drop-in replacement, just copy the files of this patch over the current ones. 


===Changelog===
0.1	Intitial version - proof of concept
0.2  Merged changes from repo head
0.3  Changed names of time fields
0.4 minor changes

===To Do==
  1. may crash the browser while uploading a stack of large files
    2. set file limit
  2. provide a common summary after the upload of multiple files
    3. currently it shows only the last result
  3. preview files for upload
    4. shows thumbnail of image
    5. modify the file name and the file description
  4. test features