nooby
nooby

Reputation: 294

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

I have file input button( input type=file ). lets say i choose image. i want to get this image from input, modify it, and after that insert this modified image in the same file input.

  1. get image from input file
  2. modify it //doesnt matter how
  3. insert this image into my file input button // change old image to new one

Upvotes: 1

Views: 206

Answers (1)

online Thomas
online Thomas

Reputation: 9381

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 (I would als use an image lib)

var input = $( "input:file");

Caman(input, function () {
    this.brightness(10);
    this.contrast(30);
    this.sepia(60);
    this.saturation(-30);
    this.render();
  });

Upvotes: 1

Related Questions