2

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">
Rahul Mistry
  • 192
  • 2
  • 15

2 Answers2

5

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.

Rahul Mistry
  • 192
  • 2
  • 15
1

Creating an object whose name ends with a "/" will create a folder. It is an empty object that simulates a directory. link

I'd like to add that deleting the last object in a directory will also delete your folder. If you do not take that into account in your code, it might lead to bugs and malfunctioning.

Anas Tiour
  • 1,344
  • 3
  • 17
  • 33