Add File and Image Upload WebAPI Endpoint #11
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR# - Add File and Image Upload WebAPI Endpoint
Description
This PR introduces a new WebAPI for file and image uploads, implemented in the
FileUploadEndpointRegistrar.cs
class. The endpoints allow users to upload files and images to the server with additional functionality like cropping images and managing file paths. It also includes endpoints for retrieving and deleting files from the server.Key Features:
File Upload Endpoint:
/file/upload
FileUploadRequest
containing file details, target folder, and overwrite option.FileUploadResponse
objects with file details (URL, path, size).Image Upload Endpoint with Cropping:
/file/image
ImageUploadRequest
with optional cropping dimensions.FileUploadResponse
objects for uploaded images.SixLabors.ImageSharp
library.File Retrieval Endpoint:
/file/
File Deletion Endpoint:
/file/
Highlights:
.RequireAuthorization()
.IUploadService
to manage file storage and operations.Classes Added:
FileUploadRequest
with additional cropping options.How to Test:
File Upload:
/file/upload
with amultipart/form-data
request containing files.Image Upload with Cropping:
/file/image
with amultipart/form-data
request containing images and optional crop dimensions.Retrieve File:
/file/?path=<file_path>
.Delete File:
/file/?path=<file_path>
.