我的客户端拥有我文件夹中的所有文件名。
server.js
var express = require('express');
var formidable = require('formidable');
var app = express();
var fs = require('fs');
app.use(express.static(__dirname));
function test(){
fs.readdir('./uploads/', function(err, files) {
console.log(files); //here are the filename I wanted to get
return files;
});
}
Dropuploadfile.js
render() {
return (
<div className="wrapper">
<h1>Drop & Upload Files</h1>
<DropZoneBox url={this.props.url} onUploaded={this.appendThumbnail} />
<Output files={this.state.files} />
<br/>
<h2>List of Uploaded File</h2>
<div className="hh">
<ul>
<li>Test</li> // how to display all the filename at here ????????
<li>Test</li>
<li>Test</li>
</ul>
</div>
</div>
);
}
我需要显示我在server.js获取的所有文件名,并在dropuploadfile.js中显示,如何?谢谢