Comments (5)
@dogenius01 unfortunately I am not able to reproduce this.
Can you maybe let me know what OS and browser you are trying this on, please?
Are you able to put a repro together on github that I could take a look at?
If you copy the file (instead of uploading it) are you able to see the image/video?
Also, you describe some text at the beginning of your png file. Maybe that is not the correct format for a png? Wikipedia's description is here - I am not very familiar with PNG format, but it appears that a png should not begin with a "
or -
character.
from crud-file-server.
Hi, @omphalos
I just PUT with postman on window 7.
and crud-server is running on Ubuntu 16.04.2 LTS.
node version: v8.8.1
This is the original image.
https://drive.google.com/file/d/1pYtwrr8C2YdeXgJeB5rHsZZb-D2PWBdY/view?usp=sharing
This is the uploaded image with put operation.
https://drive.google.com/open?id=10DLSNZCwKNYjL_slupD67ohSm_eADn3z
from crud-file-server.
This is package-lock.json
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"crud-file-server": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/crud-file-server/-/crud-file-server-0.9.0.tgz",
"integrity": "sha1-vt0hh4pREfrU7TzMM9YH4r+cgvk=",
"requires": {
"mime": "1.2.7",
"optimist": "0.3.4"
}
},
"mime": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.7.tgz",
"integrity": "sha1-x6E/M6cHPZkA8ohDawazoWIAhls="
},
"optimist": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.4.tgz",
"integrity": "sha1-TW0L1x/60NpLpPbYdtXusE4HSAs=",
"requires": {
"wordwrap": "0.0.3"
}
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
}
}
}
from crud-file-server.
@dogenius01 I was able to write then read Ronno2.png correctly using the following steps:
-
Create a directory.
-
Copy example.html to that directory.
-
Copy Ronno2.png (your image file) into that directory.
-
Host that directory using crud-file-server's
-f
option. -
Navigate to http://localhost:8080/example.html using Chrome.
-
Open DevTools and execute the following code:
var getReq = new XMLHttpRequest()
var image = null
getReq.open('GET', '/Ronno2.png', true)
getReq.responseType = 'blob'
getReq.onload = function() {
image = getReq.response
var putReq = new XMLHttpRequest()
putReq.open('PUT', '/Ronno2-copy.png', true)
putReq.onload = function () { console.log('done') }
putReq.send(image)
}
getReq.send()
-
Navigate to http://localhost:8080/Ronno2-copy.png using Chrome.
-
Observe the image.
Since I was able to copy the image using the REST API, I guess the problem you're having is due to some problem with postman or how you're using postman.
Maybe there is something special you need to do on your side to get postman to properly PUT binary data?
In the example here, using XmlHttpRequest
, I needed to request a blob then send the blob to the server. Using strings didn't work for me.
I hope something here might give you a hint to help you with your postman troubles.
from crud-file-server.
@omphalos
You are right.
The problem was the way of using the postman.
I was doing put like below(form-data).
The problem solved by change the body as binary.
Thank you for the hints!
from crud-file-server.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crud-file-server.