cfupload
is a full-stack project built with Next.js to address Cloudflare's single-upload limit of 100MB. This implementation allows for chunked file uploads, making it possible to upload larger files by breaking them into smaller parts.
- Chunked File Uploads: Overcomes Cloudflare's 100MB upload limit by splitting files into chunks.
- Customizable Chunk Size: Configure the size of each chunk to suit your needs.
- Local File Handling: Manage upload and download of files stored on your server.
You have two options to configure the project:
- Run the following command:
npm run env-init
- Follow the interactive prompts to set up your configuration.
-
Create a
.env.local
file in the root directory of the project with the following template:USER_NAME=root USER_PASSWORD=123456 SECRET_KEY=471d7493bc8325b9e5a31251303396fb9cbfc253401fb75fafd93eba0c80981bad5d719839103ac2d8c0aeef7b5754a09ea254daa76c3e424c4753cb56da661651deb46a2957027b04c1c3365d5ba030593138905dd147079f6588233a1a434fe2ddca5edb76c89d4c9af1e49d0d483f34a5dd2bf4c1f2011432e8a93602298d BASE_PATH=C:/Users/YourUsername/Documents/work NEXT_PUBLIC_CHUNK_SIZE_MB=50
Adjust the values according to your needs:
USER_NAME
: Your desired usernameUSER_PASSWORD
: Your desired passwordSECRET_KEY
: A long, random string for security (you can generate this using a secure method)BASE_PATH
: The absolute path where you want to store uploaded and downloaded filesNEXT_PUBLIC_CHUNK_SIZE_MB
: Set to a value less than 100MB to account for possible additional form metadata
-
Install project dependencies:
npm install
-
Set up the configuration (if you haven't already):
npm run env-init
Or manually create the
.env.local
file as described above. -
Build the project:
npm run build
-
Start the server or change the port:
PORT=3000 npm run start
- Upload Files: Use the provided upload functionality to send files to the server.
- Download Files: Access and download files stored in the specified
BASE_PATH
.
Feel free to submit issues or pull requests to improve the project. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.