GithubHelp home page GithubHelp logo

shopmaker-com / html5-upload Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 172 KB

A simple backend for html5 uploads, made with Sinatra and jQuery File Upload

License: MIT License

Ruby 22.26% JavaScript 53.79% CSS 6.90% HTML 17.05%
html5-uploader sinatra backend jquery frontend

html5-upload's Introduction

Sinatra backend for html5 uploads

This is a simple backend for html5 uploads, made with Sinatra and jQuery File Upload Plugin, focused primarily on providing a backend for very large uploads with support for resuming interrupted uploads.

Features

  • Resumable uploads
  • In theory, unlimited file sizes (tested up to 10Gb)
  • Multiple files at once

Requirements

  • Unix or compatible OS
  • Ruby 1.9.3 or greater
  • Bundler

How to install?

Download the files, and for the development version, cd into the directory and run

bundle install

After the installation finishes, you can run the server with

rackup

and you should be able to reach the app at http://localhost:9292.

How to use?

There are two major components to this setup: the frontend, which is built with blueimp's jQuery multiple file uploader and the Sinatra backend.

In the backend, the app provides three routes, found in app/upload.rb (the main app file):

  • "/" aka the index, which displays the upload UI

  • POST "/upload" which accepts uploaded chunks

  • GET "/upload" which accepts JSON in the format

     {file: <filename>}
    

    and returns

     {status: 200, file: {name: <filename>, size: <uploaded bytes so far>}}
    

javascript uploader can then use this info to figure out where to resume the upload.

You can customize the upload directory, or submit other data during the file upload, directly in the upload.rb.

As far as the frontend script goes, you can pretty much use anything that's based on jQuery multiple file uploader, for example Adam Filkor's beautiful html5uploader

Licence

MIT

html5-upload's People

Contributors

flth avatar gauda avatar markokacanski avatar

Watchers

 avatar  avatar  avatar

Forkers

markokacanski

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.