antville/code/Site/getfile.hac
2002-12-01 19:26:40 +00:00

15 lines
No EOL
476 B
Text

/**
* this action tries to get a file with the given name
* if it finds it, it increases the request-counter of this file
* sets the appropriate mimetype and redirects the browser to the file
*/
var f = this.files.get(req.data.name);
if (f) {
f.requestcnt++;
res.contentType = f.mimetype;
res.redirect(getProperty("fileUrl") + this.alias + "/" + f.name);
} else {
res.message = getMessage("error","fileNotFound",req.data.name);
res.redirect(this.href());
}