Permalink
Browse files

WIP: Saving

  • Loading branch information...
fabianhjr committed Dec 13, 2012
1 parent 23517bf commit 1aaa0b3791d577171bec6b928e4434b5bf02cb82
Showing with 10 additions and 4 deletions.
  1. +2 −0 server/.gitignore
  2. +3 −2 server/app.js
  3. +5 −2 server/views/index.jade
View
@@ -1 +1,3 @@
node_modules/
+uploads/
+log.txt
View
@@ -1,3 +1,4 @@
+var fs = require("fs");
var express = require("express");
var app = express();
@@ -7,7 +8,7 @@ app.set('view engine', 'jade')
var saveReport = function(report){
// Saves the report
- fs.appendFile('log.txt', report, function(err){
+ fs.appendFile('log.txt', JSON.stringify(report), function(err){
console.log(err);
});
return 0;
@@ -18,7 +19,7 @@ app.get('/', function(req, res){
})
// POST Datos
-app.get('/newreport', function(req, res){
+app.post('/newreport', function(req, res){
try {
var report = {
image: req.files.image,
View
@@ -1,6 +1,9 @@
html
body
h1 Hello
- form(method='post',action='/newreport')
- input(type='file')
+ form(method='post', action='/newreport', enctype="multipart/form-data")
+ input(name='image', type='file')
+ input(name='location', type='hidden')
+ input(name='time', type='hidden')
+ input(name='type', type='hidden')
input(type='submit') Subir

0 comments on commit 1aaa0b3

Please sign in to comment.