Skip to content

An ASP.NET Web API for seamless file uploading and downloading operations

Notifications You must be signed in to change notification settings

AbdullrhmanElhelw/FileUploadingAndDownloadingWebAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileUploadingAndDownloadingWebAPI

This ASP.NET Web API provides endpoints for seamless file uploading, downloading, listing, updating, and deleting operations. It simplifies the process of handling various file types, including image uploads. The API is built on the ASP.NET framework and leverages the Entity Framework for data storage.

Endpoints:

Upload a Single File

  • Endpoint: POST /api/File/Upload
  • Request:
    • Form Data: file (IFormFile)
  • Response:
    • If successful, returns the ID of the uploaded file.

Download a File

  • Endpoint: GET /api/File/{id}
  • Request:
    • Path Parameter: id (int)
  • Response:
    • Downloads the file associated with the specified ID.

List All Files

  • Endpoint: GET /api/File/List
  • Response:
    • Returns a list of filenames.

Delete a File

  • Endpoint: DELETE /api/File/{id}
  • Request:
    • Path Parameter: id (int)
  • Response:
    • Deletes the file associated with the specified ID.

Update a File

  • Endpoint: PUT /api/File/{id}
  • Request:
    • Path Parameter: id (int)
    • Form Data: file (IFormFile)
  • Response:
    • Updates the file associated with the specified ID.

Upload an Image with Validation

  • Endpoint: POST /api/File/UploadImage
  • Request:
    • Form Data: image (IFormFile)
  • Response:
    • If successful, returns the ID of the uploaded image.

Upload Multiple Files

  • Endpoint: POST /api/File/UploadMultipleFiles
  • Request:
    • Form Data: files (List)
  • Response:
    • If successful, uploads multiple files.

Getting Started:

  1. Clone the repository.
    git clone https://github.com/yourusername/AspNetFileManagementWebAPI.git
    

Prerequisites:

Installation:

# Install the .NET 8 SDK
# Visit https://dotnet.microsoft.com/download/dotnet/8.0 to download and install the SDK
# Skip this step if you already have .NET 8 installed
dotnet --version

# Install Entity Framework Core packages
dotnet add package Microsoft.EntityFrameworkCore
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools

# Restore the project to apply changes
dotnet restore

About

An ASP.NET Web API for seamless file uploading and downloading operations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages