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

158
Views
Azure Custom Vision Send file as file in Javascript

i'm trying to send a file into Azure service file is not vailed when i send it i'm using https://html2canvas.hertzen.com/ to generate images

Azure documentation :https://docs.microsoft.com/en-us/rest/api/customvision/training3.3/create-images-from-files/create-images-from-files#examples


$(window).bind("load", function() {
                html2canvas(document.querySelector(".classname"), {
                    scale: 2,
                }).then(canvas => {

                    var imagedata = canvas.toDataURL('image/png', 1.0);
                     imagedata = imagedata.replace(/^data:image\/(png|jpg);base64,/, "");
                    // console.log(imagedata);
                    // var data = {};
                    // var imgagefile = data['image']=imagedata;
                    let resp = JSON.stringify(imagedata);
                    res = JSON.parse(resp);
                    $.ajax({
                        url: 'https://<stance-name>.cognitiveservices.azure.com/customvision/v3.3/training/projects/<project-id>/images/files',
                        headers: {
                            'Training-Key': '<Training-Key>',
                            'Content-Type': 'application/json'
                        },
                        method: 'POST',
                        dataType: 'json',
                        data: JSON.stringify({
                                         "images":[
                                        {
                                        "name": "hemlock_10.png",
                                        "contents":res ,
                                        }
                                    ],
                                "tagIds": [
                                    "<the_id-herer>"
                                ]
                            },

                        ),
                        success: function(data) {
                            //     alert(data);
                            

                        },
                        error: function(data) {
                            

                        }
                    });






                });
            });

        });

thank you

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!