如何从输入类型=文件获取数据,修改它,然后将其插入到此输入JS中

how to get data from input type=file , modify it, and then insert it in this input js

本文关键字:输入 然后 插入 JS 修改 类型 文件 获取 数据      更新时间:2023-09-26

我有文件输入按钮(输入类型=文件)。 假设我选择图像。 我想从输入中获取此图像,对其进行修改,然后将此修改后的图像插入同一文件输入中。

  1. 从输入文件获取图像
  2. 修改它//如何都无所谓
  3. 将此图像插入我的文件输入按钮//将旧图像更改为新图像

HTML

<form method="post" action="upload-page.php" enctype="multipart/form-data">
        <label for="filesToUpload"> Select all photo files you need.</label>
        <br>
        <input name="filesToUpload[]" id="filesToUpload" type="file" multiple="" />
        <br><br>
</form>

jQuery (我会使用图像库)

var input = $( "input:file");
Caman(input, function () {
    this.brightness(10);
    this.contrast(30);
    this.sepia(60);
    this.saturation(-30);
    this.render();
  });
相关文章: