
Untitled
By: a guest on
Apr 15th, 2012 | syntax:
None | size: 1.32 KB | hits: 19 | expires: Never
res.end(
'<html>'+
'<head>'+
'<script type="text/javascript" src="/nowjs/now.js"></script>'+
'<script type="text/javascript">'+
'now.ready(function() {'+
' alert("Hi, this is a now.js test.");'+
' var files = {};'+
' now.startFileReceival = function(id, fileName, bytesExpected, cb) {'+
' //this file id must be unique'+
' if (typeof(files[id]) !== "undefined") {'+
' cb(false);'+
' return;'+
' }'+
' //add this file'+
' files[id] = {fileName: fileName, bytesExpected: bytesExpected, data: ""};'+
' //success'+
' cb(true);'+
' };'+
' now.receiveFileChunk = function(id, chunk, cb) {'+
' //this id must exist'+
' if (typeof(files[id]) === "undefined") {'+
' cb(false);'+
' return;'+
' }'+
' //add this chunk'+
' files[id].data += chunk;'+
' //success'+
' cb(true);'+
' };'+
'});'+
'</script>'+
'</head>'+
'<body>'+
'<form action="/upload" enctype="multipart/form-data" method="post">'+
'<input type="text" name="title"><br>'+
'<input type="file" name="upload" multiple="multiple"><br>'+
'<input type="submit" value="Upload">'+
'</form>'+
'</body>'+
'</html>'
);