Question

I'm using the simplehttpwithupload.py script, which I have linked to below, to host a simple http server where people can upload files to me. Is there a way to modify the source code so that multiple files can be selected for upload at once? Such that when the select file dialog box comes up, users can ctrl/shift click and select several files which will then be uploaded.

https://www.dropbox.com/s/wshzyseignnz78x/simplehttpwithupload.py

Thanks

Was it helpful?

Solution

Is there a way to modify the source code so that multiple files can be selected for upload at once? Such that when the select file dialog box comes up, users can ctrl/shift click and select several files

I'm pretty sure there's not a simple way. Things may have improved, but when I looked into this a year or two ago, the only solution for exactly what you're looking for is Flash based. The problem is that the file selection dialog is on the client side and multiple file selection is not directly supported in the browser.

There is a JavaScript based solution for downloading multiple files, but it doesn't exactly match what you asked for. See Upload multiple files with a single file element for the explanation, and Multiple file uploader: Mootools version for a later, prettier version.

The main idea is:

you can only store file upload information in a file upload element (), you’ll always need to have one element per file to be uploaded.

it’s actually a relatively simple matter to conceal a file element once a file has been chosen, and add a new (empty) one in its place.

To apply the JavaScript solution to simplehttpwithupload.py, you'll have to rewrite the list_directory function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top