Look at the picture first:
The main reason for this problem is that the files you are uploading are not in the same folder
So put the folder TMP and the running JS files in the same directory, as shown in the figure below:
Then the path is changed. The first path I wrote was fs.readfile (“/ TMP /test.png”…) There is no problem changing “/ TMP /test.png” to “./ TMP /test.png”
Fs. ReadFile (“./TMP/test. The PNG “, “binary”, function (the error, the file) {
if (error) {
response. WriteHead (500, {” content-type “:” text/plain “});
response. Write (error + “\ n”);
the response. The end ();
} else {
response. WriteHead (200, {” content-type “:” image/PNG} “);
response. Write (file, “binary”);
the response. The end ();
The main reason for this problem is that the files you are uploading are not in the same folder
So put the folder TMP and the running JS files in the same directory, as shown in the figure below:
Then the path is changed. The first path I wrote was fs.readfile (“/ TMP /test.png”…) There is no problem changing “/ TMP /test.png” to “./ TMP /test.png”
Fs. ReadFile (“./TMP/test. The PNG “, “binary”, function (the error, the file) {
if (error) {
response. WriteHead (500, {” content-type “:” text/plain “});
response. Write (error + “\ n”);
the response. The end ();
} else {
response. WriteHead (200, {” content-type “:” image/PNG} “);
response. Write (file, “binary”);
the response. The end ();
}});
Read More:
- #During OpenGL development, fatal error C1083: can’t open include file: “GL / glut. H”: no such file or directory
- A fatal error C1083 occurred when compiling C + + code under. Net: unable to open the include file: “xuhk”_ Jnihelloworld. H “: solution to no such file or directory error.
- Error: ENOENT: no such file or directory, mkdir E:\
- Error: enoent: no such file or directory
- The first time I write OpenGL program, what should I do when I encounter “can’t open include file:” GL / glaux. H “: no such file or directory”?
- Error: enoent: no such file or directory, stat
- Clion develops STM32, adds files and compiles with an error “no such file or directory”“
- NPM installation module encountered enoent: no such file or directory, rename error
- Error: enoent: no such file or directory, stat ‘/ usr / local / var / www / /_ book/gitbook/git
- Error: enoent: no such file or directory, stat ‘/ usr / local / var / www / / book/gitbook/git
- Cannot open include file: ‘io.h‘: No such file or directory
- In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory
- VS2010 compiler can’t open include file: “GL / glaux. H”: no such file or directory
- Error: ENOENT: no such file or directory, uv_cwd Error: Cannot find module
- When Python Django creates a database, can’t open file ‘ manage.py ‘: [Errno 2] No such file or directory
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- [tools] vscode debug report G + +. Exe no such file or directory fatal error no input files
- Syntax Error: Error: ENOENT: no such file or directory, scandir ‘D:
- npm ERR! Error: EPERM: operation not permitted, open ‘C:\Program Files\nodejs\node_ Solution to cache / xxx
- OSError: libnccl.so.2: cannot open shared object file: No such file or directory