Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

223
Visualizações
how can I get my file directory / file path when file selected by input in react or html

I selected file and put it in state - everything about file object work properly but the but the webkitRelativePath is null ,

     <input type="file" onChange={changeHandler} id="main_img" name="img" style{{display:'none'}} webkitdirectory  />//this my input

state{//this is my state
  name:"1112.PNG"
  lastModified:1645438409236
  lastModifiedDate:Mon Feb 21 2022 13:43:29 GMT+0330 (Iran Standard Time)
  webkitRelativePath:""
  size:1158291
  type:"image/png"
  arrayBuffer:ƒ arrayBuffer() {}
  slice:ƒ slice() {}
  stream:ƒ stream() {}
  text:ƒ text() {}
}

this object is that get from input-- why webkit is empty ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The short answer is, you can't get full path of a file with JavaScript. For security reasons this is not allowed in most browsers.

webkitRelativePath only works in Chrome. This allows a user to select a folder instead of files, and every single file is read recursively. The webkitRelativePath contains the relative path of the file within the hierarchy.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda