Activities of "cotur"

Hi,

There is no any option about file sizes in ABP Framework or related modules.

You may research for online. ABP Framework and File Management module use the default settings of ASP.NET.

Here is the full documentation for it.

https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services

Hi @zsanhong,

Files that uploaded with File Management module can't be downloaded directly by a link for now. We've added "token validation" for extra security.

First, the UI makes a request to the backend application to take token, that token will be used for download, Example:

File name: myfile.zip UI makes a request -> // api/file-management/get-token Token = 12345 UI opens a new tab with the url -> api/file-management/[MY-FILE-ID]?token=12345 Then the download process will start.

Tokens become expired when they used once. So, for each download request, you need to consume new token.

So, how you can achieve your request, let me show you one example.

You may create unique tokens for each dowload request by overriding DownloadAsync method of FileDescriptorController controller:

Note that, you need to secure your api yourself.

[HttpGet]
        [Route("download/{id}")]
        [AllowAnonymous]
        public virtual async Task<IRemoteStreamContent> DownloadAsync(Guid id, string token)
        {
            var fileDescriptor = await FileDescriptorAppService.GetAsync(id);
            
            // add this
            if(string.IsNullOrWhiteSpace(token))
            {
                token = await FileDescriptorAppService.GetDownloadTokenAsync(id); 
            }
            
            Response.Headers.Add("Content-Disposition", $"attachment;filename=\"{fileDescriptor.Name}\"");
            Response.Headers.Add("Accept-Ranges", "bytes");
            Response.ContentType = fileDescriptor.MimeType;

            return await FileDescriptorAppService.DownloadAsync(id, token);
        }

Hi,

We need more information about this issue, can you please share your HttpApi.Host logs.

I see content-disposition: attachment;filename="text.txt" in your response, that means whole application process is successfully finished.

You may have some permission issue or Streaming issue with IIS. Please check IIS logs also.

Hi @thaithiendi,

I want to update one thing about @albert's reply, we will implement paging in 5.0 version. Not v.4.4.

What we're trying to do here is to use gridfs for storing files. And for that we dont require creating an entity. So there are some definitions we've to make at the several layers:

For example, usually in the case of having an entity: public class MongoDbFileRepository :MongoDbRepository<BookStoreMongoDbContext, Author, Guid>, IFileRepository

In our case we just used: public class MongoDbFileRepository : IFileRepository

Could this be the cause of the dependency injection error?

Is there any reference or example where we just capture data from from api and not use any entities?

Please help.

Thank you.

About this issue,

You can consider to create your own BLOB Provider. As you mentioned you want to use it for files.

Here are detailed documentations.

BLOB Storing BLOB Storing: Creating a Custom Provider

Hi, you can use IRemoteStreamContent for file upload & download actions.

https://docs.abp.io/en/abp/latest/Application-Services#working-with-streams

We don't support streaming for Blob Storage DB provider. Because the EF Core does not support streaming from database. We have api for streams but DB Provider reads all the bytes then it returns them with a memory stream.

If you thing that you will store big files, you can use other providers instead of Db Provider.

Oh, there was no version decleration before or I missed it.

Thanks for informing us about the problem, we will start to test it.

I need one more information, which provider do you use for BLOB Storing? Database, file, azure...?

Actually, the problem is really big.

At the 3.3.2 version, we are not using stream objects from backend, so the Angular UI tries to get all byte content then it converts the object to a downloadable file in memory.

The root of the problem may be anywhere. :\ Http request may become closed (500 mb is so big) or memory problems etc.

When you update backend for stream using, your download process will become broken also, because as I said, angular gets the byte content then converts it.

For the latest version Blazor WASM & Angular, whole download process handled by backend. We create a unique token for one download request etc. There are so many updates.

I think the easiest way is upgrading your projects ABP Version.

Showing 31 to 40 of 89 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11