Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/express.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ AvatarUploader = papercut.Schema (schema)->
@version
name: 'avatar'
size: '200x200'

@version
name: 'origin'
process: 'copy'

express = require('express')
app = express()
Expand Down Expand Up @@ -48,8 +52,10 @@ imageId = 0

app.post '/avatar', (req, res)->
uploader = new AvatarUploader()
timeStamp = new Date()
timeStamp = timeStamp.getTime()

uploader.process "#{imageId++}", req.files.avatar.path, (err, images)->
uploader.process "#{timeStamp}_#{req.files.avatar.name}", req.files.avatar.path, (err, images)->
res.send 200, """
<html>
<head>
Expand Down