javascript - 生产模式下未定义的event.target.files react js
问题描述
我正在尝试通过输入将图像发送到 aws s3,这在开发模式下工作得很好,但是,当我在我的域上尝试它时,它不再工作它说无法获得未定义的属性。
const upload = async (e) => {
const S3client = new S3(config);
const teste = crypto.randomBytes(20).toString('hex');
let location = null;
console.log(e.target.files[0]);
await S3client.uploadFile(e.target.files[0], teste)
.then(async (datum) => {
location = datum.location;}
}
不知道为什么这不适用于生产模式
<div className="upload-photo-contain">
<form onChange={upload}>
<input type="file" id="img" name="img" accept="image/*" />
<label htmlFor="img">
<div className="upload-photo-box">
我就是这样称呼这个事件的
解决方案
推荐阅读
- node.js - 在 mongoose 中使用 or 和 and 运算符
- modelica - cd 命令在 Dymola.mos 文件中不起作用
- binaryreader - 有没有办法读取存储在二进制(.bin)文件中的信息?
- stargazer - 观星者:F Statistic / df 中的换行符
- typescript - 如何在 TypeScript 中使对象参数的一个属性是必需的,而其余的属性是可选的?
- sql - 为 SSRS 报告上的多值过滤器参数显示的表达式
- c++ - 在一个句子中找到一个单词 c++
- azure-eventhub - ReadEventsAsync 间歇性地得到 EventHubsExeception(ConsumerDisconnected)
- jquery - 构建错误(SourceMapConcat)没有这样的文件或目录,打开tmp/source_map_concat-input_base_path-.tmp/bower_components/jquery/dist/jquery.js
- xcode - Xcode 12 - 项目导航器宽度被卡住/锁定,无法调整大小