https://github.com/phstc/uploader_nodejs
It's a file upload with progress and credential checker implemented in Node.js
https://github.com/phstc/uploader_nodejs
Last synced: about 2 months ago
JSON representation
It's a file upload with progress and credential checker implemented in Node.js
- Host: GitHub
- URL: https://github.com/phstc/uploader_nodejs
- Owner: phstc
- Created: 2012-06-15T01:10:49.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-06-25T14:18:27.000Z (about 14 years ago)
- Last Synced: 2025-01-27T08:45:27.664Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://superuploads.herokuapp.com/
- Size: 246 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
It's my solution to the Code Challenge [File Upload with Progress](https://github.com/phstc/uploader_nodejs/blob/master/BackendDeveloperChallengeUpdated.pdf).
I decided to split this project into small projects, the [Uploader in Node.js](https://github.com/phstc/uploader_nodejs) and the [Uplader client in Rails](https://github.com/phstc/uploader_rails). It's a kind of System of Systems, Node.js fits better for the upload (event-driven, non-blocking I/O) and Rails fits better for the client (gems, community, maturity etc).
[](http://travis-ci.org/phstc/uploader_nodejs)
##Upload progress
When a client sends an upload request, it needs to send a socketid parameter.
/upload?socketid=...&security_hash=..×tamp=..
This socketid parameter is the ID generated from the [socket.io](http://socket.io/).
var socket = io.connect(...);
socket.on('connect', function () {
var formAction = "/upload?socketid=" + socket.socket.sessionid;
$("#form_upload").attr('action', formAction);
See a full example at [github.com/phstc/uploader_nodejs/blob/master/public/index.html](https://github.com/phstc/uploader_nodejs/blob/master/public/index.html).
###Status
The Uploader will update the status to client in three channels: ```upload_percentage```, ```uploaded_file``` and ```upload_error```.
'uploaded_file', {path: file.path, name: file.name}
'upload_percentage', percentage
'upload_error', 'invalid credential'
##Credential
To validate if the upload request is from a valid client, the upload request must pass a ```security_hash``` and ```timestamp```.
The ```security_hash``` is ```md5(SECRET_KEY + timestamp)```.
##Running it
$ make server
###Test suite
$ make test