Skip to content

Commit

Permalink
use separate tempfile directory
Browse files Browse the repository at this point in the history
  • Loading branch information
anneb committed Sep 10, 2019
1 parent 8bab553 commit eb592d8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
config/dbconfig.json
admin/files
cache
2 changes: 2 additions & 0 deletions admin/files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions admin/temp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
9 changes: 7 additions & 2 deletions admin/upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@


function progressHandler(event){
document.querySelector("#status").innerHTML = `Uploaded ${byteString(event.loaded,1)} of ${byteString(event.total,1)}`
let percent = 100 * event.loaded / event.total;
document.querySelector("#status").innerHTML = `Uploaded ${byteString(event.loaded,1)} of ${byteString(event.total,1)}`;
let percent;
if (event.total) {
percent = 100 * event.loaded / event.total;
} else {
percent = 100;
}
let secondsElapsed = (Date.now() - timeStart)/1000;
let speed;
if (secondsElapsed > 1) {
Expand Down
2 changes: 1 addition & 1 deletion upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function(app, pool) {
}
app.use(fileUpload({
useTempFiles: true,
tempFileDir : `${__dirname}/admin/files/`
tempFileDir : `${__dirname}/temp/`
}));

app.post('/admin/upload', (req, res) => {
Expand Down

0 comments on commit eb592d8

Please sign in to comment.