Skip to content

Commit

Permalink
create uploads if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
eferhatg committed Apr 11, 2016
1 parent db994dc commit 7351c64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function AnswerController(db) {
AnswerController.prototype.answer = function(request, reply) {
try {

this.answerModel.answer()
this.answerModel.answer();

} catch (e) {
reply(Boom.badRequest(e.message));
Expand Down
4 changes: 4 additions & 0 deletions controllers/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ QuestionController.prototype.upload = function(request, reply) {
});

var data = request.payload;
var dir = __dirname + "/../uploads";
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}

if (data.file) {
var name = data.file.hapi.filename;
Expand Down

0 comments on commit 7351c64

Please sign in to comment.