Search code examples
minio

How to Add folder in Minio bucket using c#?


I am using Minio .net client library

my requirement is how can i store my files in folder structure like

ABC is Bucket, CMS is inner folder and CMS folder contains files so how can i achive this ?

amazon s3 doing same things using key value pair i.e ABC/CMS

EDIT:

How can i access files url in my .net project ? Ex In ABC bucket i have abc.png file so how can i access image to display on HTML tag.

<img src="---any path---/abc.png">

Solution

  • Here is the solution of my own question.

     var fileAsStreamData = file.OpenReadStream();
     var fileName = "cms/" + file.FileName;
     await _minioClient.PutObjectAsync("ASAP", objectName: fileName, data: fileAsStreamData, size: file.Length, contentType: file.ContentType);
    

    Note:where "/" indicating folder structure in minio. Ex. A/B/C/D/any_file_name so its consider as a inner folder like B is a inner folder of A and C is a inner folder of B and so on.