Advertisement
Guest User

Untitled

a guest
May 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function doServeFile(name, fullpath, res) {
  2. if (fullpath) {
  3. console.info("---try send file:" + fullpath);
  4. res.sendFile(fullpath);
  5.  
  6. }else {
  7. res.status(404);
  8. }
  9. }
  10.  
  11. router.get("/:id", function (req, res, next) {
  12. Model.findById(id).then(file=> {
  13. var fullPath = Config.uploadDest + "/" + file.path;
  14. doServeFile(file.filename, fullPath, res)
  15. }).catch(Util.dbErrorHandler);
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement