editor-js / editor-js/image

Not getting the file object while using custom uploader.

Open
#50 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
285
Forks
307
PR merge metrics
No merged PRs in 30d

Description

I am trying to use custom uploader, specifically uploadByFile method. This method takes one argument, which is supposed to be the file that we need to upload on the server. What I am getting isa bunch of file properties, but the actual file is missing.

Here is the reference code.

```
tools: {
image: {
class: ImageTool,
config: {
uploader: {
uploadByFile(file) {
return fetch('http://localhost:3001/api/v1/file_upload', {
method: 'post',
body: JSON.stringify{
file: file,
filename: 'first_img'
})
}).then(function(response) {
return {
success: 1,
file: {
url: 'https://my-photo-gallary.s3.ap-south-1.amazonaws.com/go_that_extra_mile.png'
}
}
})
}
}
}
}
}
```

Here is what I receive when logging the file argument.

![Screen Shot 2019-10-17 at 10 45 51 PM](https://user-images.githubusercontent.com/13403056/67032614-8ba44180-f131-11e9-8bad-8a08164eb07e.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.