Base solution for your next web application
Open Closed

Demouicomponents file upload bug #6588


User avatar
0
byeniceri created

Hi

I would like to implement file upload function like Demouicomponents but when i try the file upload with tenant user, GetFile function returns null. (It is working with host user) What is the problem is there a bug? Aspnetcore mvc 6.7 version


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    It may be that you have a TenantId in your BinaryObject entity. You can add the TenantId parameter to the GetFile method and then switch tenantid in the method.

  • User Avatar
    0
    pointlevel created

    I think the problem is that the TenantId is not saved to DB. When i try my multitenant app and the demo, the TenantId is null. This gives the same error.

    Why is not TenantId saved to the DB when logged in as a tenant? The BinaryObject.cs has "IMayHaveTenant" with nullable Id. If i add the tenantId manually to the DB the image is shown correctly.

  • User Avatar
    0
    aaron created
    Support Team

    Try changing this line in DemoUiComponentsController.cs:

    - var fileObject = new BinaryObject(null, fileBytes);
    + var fileObject = new BinaryObject(AbpSession.TenantId, fileBytes);
    
  • User Avatar
    0
    pointlevel created

    Thanks aaron, my problem solved. I hope this solves the problem byeniceri has also.

  • User Avatar
    0
    aaron created
    Support Team

    Thanks for verifying! I've submitted a PR: aspnetzero/aspnet-zero-core#2239