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

149
Vistas
How to to get Image file metadata from it's path

I want to upload a image file from Reactjs which is in my project folder ("../assets.cover.png") without using input, when I'm trying import cover from "../assets.cover.png" it's giving me file path but what I need is file metadata to upload it.

Basically my final intention is to upload that image file and calculate user upload speed.

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

0

The imported image is just a file path relative to the base url for use on properties, you'll have to read the file to do what you are attempting.

about 4 years ago · Juan Pablo Isaza Denunciar

0

I was able to resolve it after reading after reading this documentation

import cover from "../assets/cover.png"; // importing img file

let blob = await fetch(cover).then((r) => r.blob()); //creating blob object

const file = new File([blob], "cover.png", {
  type: "image/png",
});

console.log(file);

// output
// {
//   lastModified: 1656486792733
//   lastModifiedDate: Wed Jun 29 2022 12:43:12 GMT+0530 (India Standard Time) {}
//   name: "cover.png"
//   size: 1446458
//   type: "image/png"
//   webkitRelativePath: ""
// }

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