What is the correct path I need to see my uploaded image?

后端 未结 2 1708
花落未央
花落未央 2021-01-22 12:49

In my web application one of my pages is uploading a photo to the path

/usr/local/rac/picture-name-goes-here

The photo is uploading fine, but I need to acces

2条回答
  •  遇见更好的自我
    2021-01-22 13:35

    src="/usr/local/agent/photo-name-here.jpg" <- this URL is a local address in your server, to show up your images you have to set a valid HTTP address like:

    http://www.yourdomain.com/images/photo-name-here.jpg

    To accomplish that you will need to upload the foto to a localpath that is inside in your www root folder.

    If your webapp is installed in

    • /home/apache/www/website/

    you will upload your images to a folder like:

    • /home/apache/www/website/images/

    and then your HTTP address will be

    • http://www.yourdomain.com/images/photo-name-here.jpg

    I got a little confuse with your two paths in /usr/ and C:\Tomcat

    I encourage you to put the upload localpath folder parametrized, so you will be only modifying the config file instead of every function or method that access to that local path.

提交回复
热议问题