Merge pull request #339 from gitroomhq/feat/file-path

fix file path
This commit is contained in:
Nevo David 2024-10-07 22:20:20 +07:00 committed by GitHub
commit 46ef91b9d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -43,9 +43,8 @@ export class MediaController {
@GetOrgFromRequest() org: Organization,
@UploadedFile() file: Express.Multer.File
) {
const uploadedFile = await this.storage.uploadFile(file);
const filePath = uploadedFile.path.replace(process.env.UPLOAD_DIRECTORY, basename(process.env.UPLOAD_DIRECTORY));
return this._mediaService.saveFile(org.id, uploadedFile.originalname, filePath);
const uploadedFile = await this.storage.uploadFile(file);
return this._mediaService.saveFile(org.id, uploadedFile.originalname, uploadedFile.path);
}
@Post('/upload-simple')

View File

@ -54,7 +54,7 @@ export class LocalStorage implements IUploadProvider {
const publicPath = `${innerPath}/${randomName}${extname(
file.originalname
)}`;
console.log(filePath);
// Logic to save the file to the filesystem goes here
writeFileSync(filePath, file.buffer);