Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

439
Vistas
convert cURL command to http put request

i need to convert the following cURL command:

curl --request PUT \
--url https://storage.bunnycdn.com/storage/path/index.jpeg \
--header 'AccessKey: <AccessKey>' \
--header 'Content-Type: application/octet-stream' \
--data-binary @/home/path/to/index.jpeg

which sends a put request with an image to be uploaded to a CDN

to an https put request, specially with the --data-binary

i tried :

   try {
                  var request = new http.MultipartRequest("PUT", uri);
                  request.headers.addAll({
                    'content-type': 'multipart/form-data',
                    'AccessKey': '<AccessKey>',
                  });

                  request.files.add(
                    await http.MultipartFile.fromPath(
                      'file',
                      _image.path,
                      filename: fileName,
                    ),

                  );

                  var response = request.send().then((value) => setState(() {
                        isLoading = false;
                      }));
                } catch (e) {
                  print(e);
                }

but unfortunately the file arrives at the CDN storage with wrong formatting.

how can i upload the image with http put request as --data-binary

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use postman to convert curl to some languages, to javascript postman return this:

var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://storage.bunnycdn.com/storage/path/index.jpeg',
  'headers': {
    'AccessKey': '<AccessKey>',
    'Content-Type': 'application/octet-stream'
  },
  body: '@/home/path/to/index.jpeg'

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

This is just a example, so if you need something more elaborated do it.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda