upload file image is broken with rest api
Added by huy nguyen over 3 years ago
i used rest api
POST /uploads.xml?filename=image.png
Content-Type: application/octet-stream
...
(request body is the file content)
- 201 response
<upload>
<token>7167.ed1ccdb093229ca1bd0b043618d88743</token>
</upload>
file has upload to server success, file format pdf, exe, zip, rar... active oke but file format image/png, image/jpeg, video/mp4 not open
My code:
const data = new FormData();
data.append('file', event.target.files[0]);
$.ajax({
type: "POST",
url: IP_ADDRESS_REDMINE + '/uploads.json?filename=' + event.target.files[0].name,
data: data,
dataType: "JSON",
processData: false,
filename: event.target.files[0].name,
headers: {
'Authorization': `Basic ${basic_token}`,
'Content-Type': 'application/octet-stream',
},
error: function (response) {
}
}).done(function (res) {
});
pic_e.png (30.7 KB) pic_e.png | image not open in website | ||
not-open.PNG (47.6 KB) not-open.PNG | after download not open image |
Replies (2)
RE: upload file image is broken with rest api - Added by Federico Vergelli about 3 years ago
Same.
Have you fixed it? or discover what went wrong?
RE: upload file image is broken with rest api - Added by Franck VALETAS 12 months ago
Same problem. Did you solve it ?
Yhanks