aspose file tools*
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
Author

Upload succesful but cant reach from http

Jesus Espinoza
Greenhorn

Joined: Sep 07, 2011
Posts: 3

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

Joined: Jan 10, 2002
Posts: 61768
    
  67

TellTheDetails

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] [Bear's FrontMan] [About Bear] [Books by Bear]
    Jesus Espinoza
    Greenhorn

    Joined: Sep 07, 2011
    Posts: 3

    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
    Bartender

    Joined: Oct 14, 2005
    Posts: 18991
        
        8

    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

    Joined: Sep 07, 2011
    Posts: 3

    I guess ill try

    thanks guys for your answers
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Upload succesful but cant reach from http