Asp.Net Core Mino Usage

What is Minio?

MinIO is an Amazon S3 compatible server-side software storage, which stores image, video, log, files etc.

Development Environment
  • Windows 10
  • Asp.net Core 3.1
Installing and Running Operations

We download minio from link. The Link is for Windows, We look link for macos and linux-like platforms, see this link.

After downloading Minio, We run cmdfrom file location. We create folder named "test" in the folder where is "minio.exe".

Minio's default username and password are "minioadmin". You can use following commands for change password

MinIo aşağıdaki komut ile ayağa kalkacaktır.

127.0.0.1:9000 is Minio url

We add bucket named "testbucket" to minio
Usage in .Net Core Projects

Firstly, We install Amazon.S3 package.

We create minio settings in appsettings.json

Let's write the service that will do the file uploadand fetching

Let's create the client with the relevant settings in the constructor of the FileOperationclass.

File Upload Function:

We set Guid to key because every file we upload must have a unique name

File Call Function:

Let's create scope of the services in startup.cs

Let's make operations of file upload and view with a simple ui design.

Entity:

We create entity named "File".

Controller:
View:
Post Controller:

With these actions, the files have been successfully uploaded.

There are two ActionResults. AllImages() function displays png images, AllPdf() lists files whose type is pdf

AllImages View:
AllPdf View:

Başka bir yazıda görüşmek üzere 🙂

You may also like...

Leave a Reply

Your email address will not be published.

English