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

229
Views
¿Por qué mi API de Imgur en Javascript no funciona?

Necesito cargar mi imagen en imgur con la API de imgur, y lo hago en Javascript, pero siempre tengo una respuesta como "429 - Demasiadas solicitudes" o "403 - Imgur está temporalmente por encima de su capacidad. Vuelva a intentarlo más tarde". Y también hago una prueba de API en PHP pero con esto no tengo ningún problema

Necesito ayuda para entender por qué mi API de llamadas en JS no funciona

(el archivo en mi función JS viene al archivo de entrada de etiquetas HTML múltiple)

Mi código JS

 function FolderAddPictureUploadImgur(file) { var imgur_client_id = "xxxx"; const formData = new FormData(); formData.append('image', file); fetch('https://api.imgur.com/3/image', { method: 'POST', headers: { Authorization: 'Client-ID '+ imgur_client_id, }, body: formData }).then(response => { console.log(response); if (response.ok) { alert('Image uploaded to album'); } }).catch(error => { console.error(error); //alert('Upload failed: ' + error); }); }

mi codigo php

 <?php $imgur_client_id = 'xxx'; $file = file_get_contents("test_image.png"); $url = 'https://api.imgur.com/3/image.json'; $headers = array("Authorization: Client-ID $imgur_client_id"); $pvars = array('image' => base64_encode($file)); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL=> $url, CURLOPT_TIMEOUT => 30, CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $pvars )); $json_returned = curl_exec($curl); // blank response echo($json_returned); $json_returned = json_decode($json_returned, true); curl_close ($curl); ?>
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!