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

190
Views
Why fetching images I can not to count number of uploaded images?

In vuejs2 app I upload images which are selected in modal form and I want to close this modal form only fg all images are saved ok(calling self.hidePhotosUploadingModal() method)

For this I set var uploaded_count and inc it on any success upload, but checking value of uploaded_count I see it is NaN

savePhotosUploadingModal() {
    let uploaded_count= 0
    let self = this
    this.imagePhotosUploadingFiles.map((nextImagePhotosUploadingFile, index) => {

        fetch(nextImagePhotosUploadingFile.blob).then(function (response) {
            if (response.ok) {
                return response.blob().then(function (imageBlob) {
                    let imageUploadData = new FormData()
                    imageUploadData.append('image', imageBlob)
                    imageUploadData.append('image_filename', nextImagePhotosUploadingFile.name)

                    Window.axios.post('/profile/upload_photo', imageUploadData).then(({data}) => {
                        // self.uploaded_count++ // IF TO UNCOMMENT THIS LINE THAT DOES NOT WORK ANYWAY
                        self.uploaded_count = self.uploaded_count + 1
                        console.log('self.uploaded_count::') // I SEE NaN IN BROWSER'S CONSOLE
                        console.log(self.uploaded_count)

                        if (self.uploaded_count === self.imagePhotosUploadingFiles.length) {
                            self.hidePhotosUploadingModal()
                        }
                        self.loadLoggedInactivePhotos()
                    }).catch((error) => {
                        console.error(error)
                    })
                })
            } else {
                return response.json().then(function (jsonError) {
                    console.error(jsonError)
                })
            }
        }).catch(function (error) {
            console.error(error)
        }) // fetch(nextImagePhotosUploadingFile.blob).then(function (response) {

    }) // this.imagePhotosUploadingFiles.map((nextImagePhotosUploadingFile, index) => {

}, // savePhotosUploadingModal

How that can be fixed ?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try to cange self.uploaded_count to just uploaded_count

about 4 years ago · Juan Pablo Isaza Report
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!