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

365
Visualizações
Unable to get relative path from root to img src in rails application

I have a small rails application in which if the environment is development, I am storing images locally. I can see that the image is successfully being uploaded but for some reason when I use the relative path of that image in the src attribute of my img tag, the image breaks and shows nothing.

The file I upload is stored in directory folder as below

       projectName
        -tmp
         -uploads
           -files
             -file
              -50
                -testImage.png

There are several folders in the project where tmp is one of those folders. Now I want to access the testImage in the src attribute of img tag. I have tried

        <img src="/uploads/files/file/50/testImage.png" />

Also,

        <img src="/tmp/uploads/files/file/50/testImage.png" />
    

But in both cases I get the image as nil.

enter image description here

Domain is localhost:3000 and img tag resides in a js file. Any help would be appreciated.

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