Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"date-and-time": "^2.4.2",
"file-saver": "^2.0.5",
"filepond": "^4.30.4",
"filepond-plugin-file-validate-size": "^2.2.8",
"js-cookie": "^3.0.1",
"jszip": "^3.10.1",
"react": "^18.2.0",
Expand Down
7 changes: 7 additions & 0 deletions client/src/screens/contributions/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Wrapper from "./components/wrapper";
import SectionC from "./components/sectionC";
import { FilePond } from "react-filepond";
import FilePondPluginFileValidateSize from "filepond-plugin-file-validate-size";
import { registerPlugin } from "react-filepond";
registerPlugin(FilePondPluginFileValidateSize);
import "filepond/dist/filepond.min.css";
import { useEffect, useRef, useState } from "react";
import "./styles.scss";
Expand Down Expand Up @@ -94,6 +97,10 @@ const Contributions = () => {
<FilePond
name="file"
allowMultiple={true}
maxFileSize="50MB"
labelMaxFileSizeExceeded="File is too large"
labelMaxFileSize="Maximum file size is 50 MB"
labelIdle='Drag & Drop your files or <span class="filepond--label-action">Browse</span> <br/> (Max file size: 50MB)'
onupdatefiles={handleUpdateFiles}
maxFiles={40}
server={{
Expand Down
5 changes: 4 additions & 1 deletion server/modules/contribution/contribution.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import catchAsync from "../../utils/catchAsync.js";
import isAuthenticated from "../../middleware/isAuthenticated.js";
import multer from "multer";

export const upload = multer({ dest: "external/uploads" });
export const upload = multer({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this, the nginx layer will not let 50 MB+ size files to reach this point. Adding this would unnecessarily make the process slow and more prone to errors. Let's keep it simple. If in future we decide to modify the limit, we'll have to update in multiple places like in frontend, server, and nginx layer. So it is better to not over complicate things and keep it simple.

dest: "external/uploads",
limits: {fileSize: 50*1024*1024}
});
router.get("/", isAuthenticated, ContributionController.GetMyContributions);
router.get("/all", ContributionController.GetAllContributions);
router.delete("/:contributionId", ContributionController.DeleteContribution);
Expand Down
Loading