Open Closed

Incorrect proxy generated for file upload API: Cannot find name 'StringValues'. #1174


User avatar
0
dev03 created
  • ABP Framework version: v4.0.2
  • UI type: Angular
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

I tried to upload a file using IFormFile, but an error occurred when generating the proxy, See this:

Did I miss something? The API like this:

Found an issue on github: https://github.com/abpframework/abp/issues/6384


12 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi coeusli

    You should use IRemoteStreamContent in app service. Then follow https://github.com/abpframework/abp/issues/6384#issuecomment-739245736

  • User Avatar
    0
    dev02 created

    Using iRemoteStreamContent, according to the documentation, the following error occurs

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi dev02

    What is your angular code that call this method?

  • User Avatar
    0
    dev02 created

  • User Avatar
    0
    dev02 created

    Try the jQuery call, same error

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You need to pass the file in the request body before v4.3.

    example:

    var settings = {
      "url": "https://localhost:44362/api/upload-file",
      "method": "POST",
      "headers": {
        "Content-Type": "image/png"
      },
       "data": "<file contents here>"
    };
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    You can use FormData after v4.3. https://github.com/abpframework/abp/pull/8302

  • User Avatar
    0
    dev02 created

    How can Ajax Data pass arguments without using FormData?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can also copy code of PR to your project then you can use FormData .

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

  • User Avatar
    0
    dev03 created

    ** ABP Framework version Upgrade to 4.4.3**

    RemoteStreamContent wèishéme shì null?

  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    Try to use same paramter name.

  • User Avatar
    1
    dev03 created

    This is fine, thank you.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 18, 2024, 05:54