Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
getting close to handle uploaded file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Atsuya Takagi committed Aug 28, 2010
1 parent 9d7af55 commit e1eb27c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 12 deletions.
20 changes: 12 additions & 8 deletions server.js
@@ -1,6 +1,7 @@
var http = require('http');
var fs = require('fs');
var url = require('url');
var sys = require('sys');

var staticResource = require('./libraries/static-resource');
//var mustache = require('./libraries/mustache');
Expand All @@ -14,18 +15,21 @@ var server = http.createServer(function(request, response) {
path = '/coming.html';
}

/*
if(mustachedPages[path]) {
} else {
*/
switch(path) {
case '/upload':
handleUpload(request, response);
break;
default:
if(!handler.handle(path, request, response)) {
response.writeHead(404);
response.write('404');
response.end();
}
/*
break;
}
*/
});
server.listen(80);
server.listen(8080);

function handleUpload(request, response) {
sys.debug('handleUpload called');
}
10 changes: 7 additions & 3 deletions static/coming.html
@@ -1,9 +1,13 @@
<html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Asuka</title>
</head>
<body>
<h1>Team Asuka!</h1>
<h1>Hi, we are team Asuka!</h1>
<div>
<a href="http://nodeknockout.com/teams/asuka" target="nko" title="Help me win Node.js KO!"><img style="position: fixed; top: 5px; right: 5px; border: 0px;" src="http://nodeknockout.com/images/voteko.png" alt="Help me win Node.js KO!" /></a>
</div>
</body>
</html>

41 changes: 40 additions & 1 deletion static/index.html
Expand Up @@ -3,9 +3,48 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Asuka</title>
<script type="text/javascript" src="/libraries/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/libraries/dnd-file-upload/jquery.dnd-file-upload.js"></script>
<script type="text/javascript" src="/libraries/dnd-file-upload/jquery.client.js"></script>
<script type="text/javascript" src="/libraries/dnd-file-upload/utils.js"></script>
<script>
$.fn.dropzone.newFilesDropped = function() {
alert('file dropped!');
// new files have been dropped
};

$.fn.dropzone.uploadStarted = function(fileIndex, file) {
alert('file uploading!');
// upload of file with given index has started
};

$.fn.dropzone.uploadFinished = function(fileIndex, file, time) {
// upload of file with given index has finished; upload took *time* mili seconds
};

$.fn.dropzone.fileUploadProgressUpdated = function(fileIndex, file, newProgress) {
// progress of given file has changed to *newProgress* percent
};

$.fn.dropzone.fileUploadSpeedUpdated = function(fileIndex, file, KBperSecond) {
// upload speed of given file has changed to *KBPerSecond* KB/s
};

$(document).ready(function(){
$('#FileDragDrop').dropzone({
url: 'http://localhost:8080/upload'
});
});
</script>
</head>
<body>
<h1>Hi, we are team Asuka!</h1>
<h1>Nanka</h1>
<div id="FileDragDrop" style="width: 200px; height: 200px; border: thin solid black;">
Drop files here!
</div>
<div id="FileView" style="width: 200px; height: 200px; border: thin solid black;">
See files here!
</div>
<div>
<a href="http://nodeknockout.com/teams/asuka" target="nko" title="Help me win Node.js KO!"><img style="position: fixed; top: 5px; right: 5px; border: 0px;" src="http://nodeknockout.com/images/voteko.png" alt="Help me win Node.js KO!" /></a>
</div>
Expand Down

0 comments on commit e1eb27c

Please sign in to comment.