• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple demo of an HTML5 multi-uploader with Python/Flask.

Flask Multi Upload Demo

This is a quick example of a Python/Flask app I wrote while figuring out how to make an HTML5 multi-file uploader script.

This app just presents an HTML form full of the usual types of input elements (text boxes, checkboxes, etc.), and a multi-file input box, and an HTML5 drag/drop target for dragging files from your PC into the page.

It demonstrates that you can combine a multi-file upload form along with other form data (i.e. letting a user choose album details to upload the pictures into). There's also a live progress bar that tells you the current progress of the upload. It doesn't break it down by individual file though, to keep things simpler.

It's backwards compatible and also works with clients that have scripts disabled. The same endpoint is used on the back-end to handle the form post and file upload; when the Ajax calls the endpoint, the Flask app returns a JSON response including the "unique ID" chosen for the upload, and then the JavaScript on the front-end initiates a redirect. With scripts disabled (so that the form will POST directly to the back-end), a normal HTTP redirect is given to the final results page.

This code demonstrates the bare essentials for how to get a multi-uploader to work using HTML5, JavaScript and jQuery -- without needing Flash or Java. It works in most modern browsers and Internet Explorer 10+.

It's only 184 lines of JavaScript and 80 lines of Python.

License

This is released in the public domain in the hopes that it will be generally useful to other developers. I wrote this just to see how to do it and to use as reference in other projects.

More Repositories

1

configdir

A cross-platform Go library to get configuration and cache directories.
Go
75
star
2

minecraft-control

A telnet wrapper for the Minecraft server that allows it to be remotely controlled.
Python
22
star
3

follow-sync

Re-synchronize your Instagram following list (or: unfollow everyone who doesn't follow you back)
Go
19
star
4

go-website-template

A good base for a Go web application.
JavaScript
12
star
5

kirsle.net

The web design and pages for my personal website.
CSS
11
star
6

programv

Alicebot ProgramV - A dusted off fork of Ernest Lergon's ProgramV updated for modern Perl
Perl
8
star
7

rophako

Migrated to https://git.kirsle.net/apps/rophako
Python
8
star
8

github-changelog

Change log generator for GitHub repositories.
Python
7
star
9

aires-bot

A multiprotocol Perl chatbot for AIM, Yahoo and others.
Perl
5
star
10

PCCC

Migrated to https://git.kirsle.net/apps/PCCC
Perl
2
star
11

Archive-Tyd

Archive::Tyd is a simple file archive algorithm that stores multiple files into an ASCII-based container, with support for compressing or encrypting the member files using a variety of algorithms.
Perl
2
star
12

bin

My collection of personal shell scripts, mostly written in Perl.
Perl
2
star
13

rivescript-cpp

Imported from code.google.com/p/rivescript-cpp
C++
2
star
14

linux-themes

Linux desktop themes for Xfce and MATE.
1
star
15

audio

An audio engine for Go (mirror of git.kirsle.net/go/audio)
Go
1
star
16

Tk-HyperText

A Perl/Tk ROText widget that renders HTML code.
Perl
1
star
17

linux-phones

Scripts and configs for GNU/Linux on smartphones.
Shell
1
star
18

Net-CyanChat

Perl interface for connecting to Cyan Worlds' chat room.
Perl
1
star
19

do-dyn-dns

Use Digital Ocean as a Dynamic DNS provider.
Go
1
star
20

perlsiikir

Legacy Perl Siikir CMS code dump (abandoned/unsupported)
Perl
1
star
21

.dotfiles

My Unix config files and shell scripts, optimized for Fedora, Debian, macOS and Windows (in that order).
Python
1
star
22

hue-toys

A Go program to do fun things with Hue lights.
Go
1
star