Browse Source

(*)文件上传名称存储优化

master
peng.peng 1 year ago
parent
commit
c95cc49a57
  1. 5
      web/client/src/components/UploadLocal/index.js
  2. 2
      web/client/src/sections/metadataManagement/containers/filesTable.js
  3. 2
      web/routes/attachment/index.js

5
web/client/src/components/UploadLocal/index.js

@ -214,7 +214,7 @@ class Uploads extends Component {
});
}
if (status === 'done') {
let { filename } = info.file.response;
let { filename, realName } = info.file.response;
let size = info.file.size;
let nextFileList = fileList;
nextFileList[nextFileList.length - 1] = {
@ -223,7 +223,8 @@ class Uploads extends Component {
status: 'done',
storageUrl: filename,
url: filename,
size: size
size: size,
realName: realName
};
onChange(nextFileList);
that.setState({

2
web/client/src/sections/metadataManagement/containers/filesTable.js

@ -279,7 +279,7 @@ const FilesTable = (props) => {
if (values.files && values.files.length) {
obj.type = values.files[0].name.split('.').pop();
obj.size = values.files[0].size;
obj.fileName = values.files[0].url.split('\\').pop();
obj.fileName = values.files[0].realName;
}
dispatch(metadataManagement.postMetadataFiles(obj)).then(res => {
if (res.success) {

2
web/routes/attachment/index.js

@ -104,7 +104,7 @@ module.exports = {
app.fs.logger.log('error', '[Upload Heatmap]', err);
});
ctx.status = 200;
ctx.body = { filename: path.join(`/assets/files/${fileFolder}`, fileName), name: 'UploadSuccess', message: '上传成功' };
ctx.body = { realName: fileName, filename: path.join(`/assets/files/${fileFolder}`, fileName), name: 'UploadSuccess', message: '上传成功' };
} catch (err) {
ctx.status = 500;
ctx.fs.logger.error(err);

Loading…
Cancel
Save