Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

408
Views
javascript save base64 image file to new file in directory

In this project my purpose is sending local image url to python or saving image to specific folder.

I am using bootstrap in this link: "https://codepen.io/aaronvanston/details/yNYOXR" for my project. I am uploading image.

https://i.stack.imgur.com/PtMxX.jpg

My javascript code in belong. How can ı take local image url or how can I save image to new file?

function readURL(input) {
    localStorage.setItem("./imgData.jpg", input.files[0]);
    if (input.files && input.files[0]) {
    var reader = new FileReader();
      
        reader.onload = function (e) {
      $('.image-upload-wrap').hide();

            $('.file-upload-image').attr('src', e.target.result);
            var fs;
            // string generated by canvas.toDataURL()
            var img = e.target.result;
            // strip off the data: url prefix to get just the base64-encoded bytes
            var data = img.replace(/^data:image\/\w+;base64,/, "");
            fs.writeFile('image.jpg', data);
      $('.file-upload-content').show();

      $('.image-title').html(input.files[0].name);
    };

        reader.readAsDataURL(input.files[0]);
       
        
  } else {
    removeUpload();
  }
}

strong text

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!