Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


	<input id="filesToUpload" type="file" multiple>
	<button id="testUpload">Test Upload</button>

<div id="status"></div>




                document.addEventListener('DOMContentLoaded', init, false);

let fileField, statusDiv;

async function init() {
	fileField = document.querySelector('#filesToUpload');
	statusDiv = document.querySelector('#status');
	document.querySelector('#testUpload').addEventListener('click', doUpload, false);

async function doUpload(e) {
	statusDiv.innerHTML = '';

	let totalFilesToUpload = fileField.files.length;
	//nothing was selected 
	if(totalFilesToUpload === 0) {
		statusDiv.innerHTML = 'Please select one or more files.';

	for(let i=0;i<totalFilesToUpload; i++) {
		statusDiv.innerHTML = `Working on file ${i+1} of ${totalFilesToUpload}`;
		let resp = await uploadFile(fileField.files[i]);
		console.log(`Done with ${i+1} item.`);
	statusDiv.innerHTML = 'All complete.';

async function uploadFile(f) {
	let form = new FormData();
	form.append('file', f);	
	let resp = await fetch('', { method: 'POST', body:form });
	let data = await resp.json();
	return data;