-
-
Notifications
You must be signed in to change notification settings - Fork 48.9k
-
-
Notifications
You must be signed in to change notification settings - Fork 48.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send multipart/form-data with antd upload #11616
Comments
well you may do it in customRequest
|
I had to do it that way. |
hey, i have a some problem. i have this call avatarUpload = file => {
const userId = this.props.userdetail.data.data.id;
const data = new FormData();
data.append('avatar', file);
const config = {
headers: {
'content-type': 'multipart/form-data',
},
};
api
.post(`${API_VERSION}/users/${userId}/avatar`, data, config)
.then(res => console.log(res))
.catch(err => console.log(err));
}; and i'm using this on <Upload
name="avatar"
action={this.avatarUpload}
listType="picture-card"
beforeUpload={this.beforeUpload}
>
<p className="ant-upload-drag-icon">
<Icon type="inbox" />
</p>
<p className="ant-upload-text">
Clique ou arraste um arquivo.
</p>
</Upload> But are returning 204, |
what do you mean.. |
Error |
Hi @Mohamed-Ghanem The Code sandbox not working Man |
Any request from this upload component is being registered as an OPTIONS request on my backend server where i need to upload the file. I cannot find cause of this. Do you have any idea? |
Here is my solution for using
and the
|
kindly show me your handleChange(); |
Version
3.8.0
Environment
react: 16.4.2, antd: 3.8.0, chrome: 67.0.3396.99
Reproduction link
Steps to reproduce
You can find the code with the issue in this sandbox:
https://codesandbox.io/s/j3q07kyy8w
What is expected?
Request Payload:
What is actually happening?
Request Payload:
This is the question on stackoverflow:
https://stackoverflow.com/q/51697944/2648837
The text was updated successfully, but these errors were encountered: