# Upload File With HTML5

| Comments

Since HTML5 is currently widely supported, and it’s a standard, it’s time to use it. Users who don’t have a modern browser should have one now. And browsers are free, why not use a faster and more standard one?

Uploading files was not supported by HTML for a long time. For example, you can not post a new file to server via Ajax. Actually you can do this, but in a hack way or with Flash. There is not even an elegent way to do this. But this will not happen any more. Things move forward. We have HTML5 now.

With HTML5, we can implement an uploading file server easily. Let me show you.

First, add this code to your html file.

Second, add the js file filedrag.js you includes in the html file.

At last, implement the server side. For instance, this is a Python code in Tornado Framework.

Here, you need to implement data_file.save() method by yourself.

Done.