-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26e705d
commit 432ac0b
Showing
6 changed files
with
163 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.env | ||
.dist | ||
.dist | ||
uploads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import multer from 'multer' | ||
import path from 'path' | ||
import * as dotenv from 'dotenv' | ||
dotenv.config() | ||
|
||
const imageFolderPath = path.join(__dirname, '../../', 'uploads') | ||
|
||
const upload = multer({ | ||
storage: multer.diskStorage({ | ||
destination: function (req, file, cb) { | ||
cb( | ||
null, | ||
process.env.NODE_ENV === 'development' | ||
? imageFolderPath | ||
: process.env.STORAGE_URL | ||
) | ||
}, | ||
filename: function (req, file, cb) { | ||
cb(null, Math.random().toFixed(2) + path.extname(file.originalname)) | ||
}, | ||
}), | ||
}) | ||
|
||
console.log(imageFolderPath) | ||
|
||
export default upload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters