Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Upload succesful but cant reach from http Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Upload succesful but cant reach from http" Watch "Upload succesful but cant reach from http" New topic

Upload succesful but cant reach from http

Jesus Espinoza

Joined: Sep 07, 2011
Posts: 3


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

Joined: Jan 10, 2002
Posts: 63862


How can we help without knowing the following?

  • Where are you storing the file?
  • What URL are you using to access it?

  • [Asking smart questions] [About Bear] [Books by Bear]
    Jesus Espinoza

    Joined: Sep 07, 2011
    Posts: 3


    Thanks for your reply.

    Im developing in Netbeans a webapp so i got

    ---+docs(uploaded files)

    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)


    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

    Joined: Oct 14, 2005
    Posts: 19973

    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

    Joined: Sep 07, 2011
    Posts: 3

    I guess ill try

    thanks guys for your answers
    I agree. Here's the link:
    subject: Upload succesful but cant reach from http
    It's not a secret anymore!