• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload succesful but cant reach from http

 
Jesus Espinoza
Greenhorn
Posts: 3
Java Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im able to upload a file in my webapp, and store it in a folder, and the url save it in a DB
but when I try to download the file via hiperlink shows me 404 error page.

when I reload the tomcat server, i can download it.

how can I avoid this?
i just want to my uploaded files be ready to download it without reloading tomcat server

also im using tomcat6

sorry for my english
and thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TellTheDetails

How can we help without knowing the following?

  • Where are you storing the file?
  • What URL are you using to access it?
  •  
    Jesus Espinoza
    Greenhorn
    Posts: 3
    Java Postgres Database Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    Thanks for your reply.

    Im developing in Netbeans a webapp so i got

    WEBAPP
    +build
    +jar
    +nbproject
    +src
    +web
    ---+META-INF
    ---+WEB-INF
    ---+css
    ---+docs(uploaded files)
    ---+img
    ---indexjsp
    +build.xml

    actually im able to store files in docs folder but when I do an <a href='/WEB-APP/docs/e10_student_vehicle.preview.jpg'>
    it sends me


    ------------------------------------------------------------------------------------------------------------------------------------------
    Estado HTTP 404 - /WEB-APP/docs/e10_student_vehicle.preview.jpg

    type Informe de estado

    mensaje /WEB-APP/docs/e10_student_vehicle.preview.jpg

    descripción El recurso requerido (/WEB-APP/docs/e10_student_vehicle.preview.jpg) no está disponible.
    Apache Tomcat/6.0.24
    ------------------------------------------------------------------------------------------------------------------------------------------

    when i browse in my folder, there is the file, and when i reload the aplication on the manager, the link work

    also, to get my files get stored i give permissions to write and read on the docs folder
    (im using Ubuntu 10.04.3 LTS)

    --------------------------------------------------------------------------------------------------------------------------------
    RESUME

    index.jsp --> uploadServlet -->file stored in /docs/ succesfully

    index.jsp updated with the new link --> link sends 404

    reload webapp from manager -->lnk now is working

    sorry for my bad english
    and thanks again for your help
     
    Paul Clapham
    Sheriff
    Posts: 21322
    32
    Eclipse IDE Firefox Browser MySQL Database
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    It's generally better to avoid storing data inside your project directory. You may think you have a problem now, but when you redeploy your project and find that all of the uploaded files are gone, you will find you have a bigger problem.

    The usual strategy is to store the data outside your project directory -- just create a directory somewhere for it -- and to write a servlet which retrieves the requested image from that directory and returns it to the client.
     
    Jesus Espinoza
    Greenhorn
    Posts: 3
    Java Postgres Database Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I guess ill try

    thanks guys for your answers
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic