question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload is not working in localhost Component:Upload

See original GitHub issue

Version

antd 3.2.0 dva 2.0.3

Environment

Mac OS High Sierra 10.13.3, Chrome version 64.0.3282.140 Node v6.9.1 npm v5.6.0

Reproduction link

https://codesandbox.io/s/q4l788znkw

Steps to reproduce

Start platform using npm run start:no-proxy. (I configured my no-proxy url in, roadhogrc.mock.js and it’s working for all the other api calls) Upload small image file.

What is expected?

It is expected to receive the file in my API service.

What is actually happening?

I checked my API service and it’s working calling upload file from a different place, but when I call it from my web built with ant design, using Upload component, Upload shows headers and request body correctly, but my API receive no files.


my code:

    <Upload
        action="/api/upload_file"
        listType="picture-card"
        showUploadList={{ showPreviewIcon: false }}
        headers={{
          Authorization: `Bearer 'token'`,
        }}
        name="file"
        withCredentials
    >
        <Icon type="plus" />
        <div className="ant-upload-text">Upload</div>
    </Upload>

Request general:

Request URL: http://localhost:8000/api/upload_file Request Method: POST

Request headers:

Accept: */* Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9,es;q=0.8 Authorization: Bearer f3618115e76f934934983ehn9RvpoN5ohGjrOoBm9E3LA9OeZbiJW Connection: keep-alive Content-Length: 9815 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrNrG4oEpcIkf8gp4 Host: localhost:8000 Origin: http://localhost:8000 Referer: http://localhost:8000/messages/new User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) > Chrome/64.0.3282.140 Safari/537.36 X-Requested-With: XMLHttpRequest

Request payload is:

------WebKitFormBoundaryrNrG4oEpcIkf8gp4 Content-Disposition: form-data; name=“file”; filename=“Trenes_de_Buenos_Aires_Logo.png” Content-Type: image/png

------WebKitFormBoundaryrNrG4oEpcIkf8gp4–

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vineetvk01commented, May 24, 2021

Hey, Any solution for this issue?

1reaction
kbardicommented, Feb 28, 2018

@zhuozp No, it is working on production but it doesn’t work on localhost. It seems to be a bug on roadhog as @yesmeck said, because it’s everything the same between production and localhost, but in localhost we use proxy defined in .roadhog.mock.js (not the mock api but a locahost url). I don’t know can we solve this problem. If you find a solution please let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP does not upload file on localhost - Stack Overflow
First things first, turn on error reporting so you can see the actual error/warning that is happening - How do I get PHP...
Read more >
Dcc.upload working on localhost but not on a hosted server in ...
When I run the app on localhost, it works perfectly. As soon as I put it on a hosted server, the dcc.upload stops...
Read more >
How You Can Fix The Biggest Problem With React File Upload
Under certain conditions, a file uploader will immediately report a server error where the console tracks a file upload, but it does not...
Read more >
ASP.NET Core Blazor file uploads - Microsoft Learn
Learn how to upload files in Blazor with the InputFile component.
Read more >
Uploader - Quasar Framework
The QUploader Vue component is a way for the user to upload files to a ... If the trigger is not working, check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found