Reputation: 8297
I am trying to upload an file using valum's ajax upload. On the server side I am using expressjs and it is a post verb. on the server side it sends back the req.session.id as json(sends the current sessionid). But at the end of the upload request, the session cookie is changed(the session is reset on the server/all the save variables are gone). I am not sure what is happening. And this is happening with APPFOG not on the localhost.
app.post '/photo/upload', (req,res)->
res.json {id: req.session.id}
on front end
uploader = new qq.FileUploader
element: document.getElementById('file-uploader')
action: '/photo/upload'
allowedExtensions: [ "jpg", "jpeg", "png", "gif" ]
sizeLimit: 0
minSizeLimit: 0
onSubmit: (id, filename) ->
onComplete: (id, filename, responseJSON) ->
photoId = responseJSON.id
It is plain expressjs app
Module dependencies.
express = require("express")
http = require("http")
path = require("path")
global.app = express()
app.set "port", process.env.PORT or 3000
app.set "views", __dirname + "/views"
app.set "view engine", "jade"
app.use express.favicon()
app.use express.logger("dev")
app.use express.bodyParser()
app.use express.methodOverride()
app.use express.cookieParser("your secret here")
app.use express.session()
app.use app.router
app.use require("stylus").middleware(__dirname + "/public")
app.use express.static(path.join(__dirname, "public"))
app.use express.errorHandler() if "development" is app.get("env")
routes = require("./routes")
http.createServer(app).listen app.get("port"), ->
console.log "Express server listening on port " + app.get("port")
Upvotes: 0
Views: 97