Is there a way to upload multiple files(lets say images to a specifc folder) in my aspose storage?
https://api.aspose.cloud/v4.0/words/storage/file/{path}
I can upload only one file right now
Is there a way to upload multiple files(lets say images to a specifc folder) in my aspose storage?
https://api.aspose.cloud/v4.0/words/storage/file/{path}
I can upload only one file right now
Currently, the Aspose Storage API does not support uploading multiple files in a single request. You can only upload one file at a time using the specified endpoint.
To upload multiple files, you will need to make separate API calls for each file. Here’s a simple example in C# to illustrate how you can upload multiple images to a specific folder:
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var files = new[] { "image1.png", "image2.jpg", "image3.bmp" };
var folderPath = "your/folder/path/";
foreach (var file in files)
{
await UploadFile(file, folderPath);
}
}
static async Task UploadFile(string filePath, string folderPath)
{
using (var client = new HttpClient())
{
var content = new MultipartFormDataContent();
var fileStream = new ByteArrayContent(System.IO.File.ReadAllBytes(filePath));
content.Add(fileStream, "file", filePath);
var response = await client.PostAsync($"https://api.aspose.cloud/v4.0/storage/file/{folderPath}{filePath}", content);
if (response.IsSuccessStatusCode)
{
Console.WriteLine($"Uploaded {filePath} successfully.");
}
else
{
Console.WriteLine($"Failed to upload {filePath}: {response.ReasonPhrase}");
}
}
}
}
In this example, replace "your/folder/path/" with the actual path where you want to upload the images. Each file is uploaded in a separate request.
For further information, please consult the official Aspose documentation on file management and API usage.
any update on this please?
No, there is no such option as S3 doesn’t support such an API.
Okay thank you