Clipso / express-file-upload

Simple file upload using ExpressJs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Node.js Express.js Application with express-fileupload

This is a basic Node.js and Express.js application that demonstrates how to handle file uploads using the express-fileupload middleware. With this middleware, you can easily handle file uploads in your Express.js application.

Prerequisites

Before you begin, ensure you have the following installed on your machine:

  • Node.js: Make sure you have Node.js installed. You can download it from nodejs.org.

Getting Started

Follow these steps to set up and run the application:

  1. Clone the repository:

    git clone https://github.com/yourusername/express-fileupload-demo.git
    cd express-fileupload-demo
  2. Install dependencies:

    npm install
  3. Start the application:

    node app.js

    The application will be running at http://localhost:3000.

Uploading Files

  1. Open your web browser and go to http://localhost:3000.

  2. You will see a simple HTML form for file uploads.

  3. Choose a file by clicking the "Choose File" button and then click the "Upload" button.

  4. The server will process the file and store it in the uploads/ directory.

Configuration

You can configure the application by modifying the config.js file. This file contains various settings, including the upload directory and allowed file types.

module.exports = {
  uploadDir: './uploads',   // The directory where uploaded files will be stored.
  allowedTypes: ['image/png', 'image/jpeg', 'image/jpg'], // Allowed file types.
};

Dependencies

This project uses the following dependencies:

  • express: Fast, unopinionated, minimalist web framework for Node.js.
  • express-fileupload: Simple Express middleware for uploading files.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Feel free to customize and expand upon this basic application to suit your specific needs. If you have any questions or run into issues, please refer to the documentation of the used libraries and feel free to open an issue on GitHub for this project.

Happy coding!

About

Simple file upload using ExpressJs


Languages

Language:JavaScript 61.2%Language:HTML 38.8%