Cant access images one directory back - linux

I am using linux server and I am using absolute path for files which is stored in a "constant"
File path is
/home1/mousi1/public_html/xyz/data/1465221530.png
Image is loading when I access file which is on home directory like
/home1/mousi1/public_html/xyz/file.php
but when I try
/home1/mousi1/public_html/xyz/subdirectory/file.php
Path is still
/home1/mousi1/public_html/xyz/data/1465221530.png
but image is not showing I am wondering why is it?
What is wrong?

Related

when i go to update the picture ic cloudinary it gives error "no such file or directory

when i go to update the picture ic cloudinary it gives error "no such file or directory , open D:/web development/mern-stack-project-course-commerce/backend/undefine
please help and check images
backend cloudinary code
throow This Error
i expect my problem slove this
The error message you're seeing is thrown by the NodeJS code which is part of the Cloudinary Node JS SDK and indicates that there is either no file at the path you provided ('D:/web development/mern-stack-project-course-commerce/backend/undefine') - this actually might be the issue since undefined is not an image, or there is a file but the permissions do not allow your code to open the file.
May I please ask you to double-check the path and if there is in fact a file there and what permissions it has? Perhaps you actually wanted a relative path?
You could also try to pass a path to a file that you definitely know exists and has the correct permissions and see if you can upload that.

Set the destination path for an uploaded image in a flask app

I have made an application in flask which asks the user to upload an image, that image is being stored in a folder inside the static folder. I have specified the full local path in the code when I run that application locally to store that image. I want to deploy this application on IBM cloud. So, I can't write the path that I had set on my local machine. Any help what path should I give for the folder where the image is to be uploaded. Thanks in advance.
You want to use absolute paths.
MYDIR = os.path.dirname(__file__)
os.path.join(MYDIR + "/" + app.config['UPLOAD_FOLDER']

Xpages Layout Control - Node Image path

I use Application Layout control (OneUI 3.0.2) with a few Application Links.
The image path is calculated because the images are saved in a separate image application.
The problem is that the Layout Control always add the path of the current application in front of the calculated link.
The only way i found was to calculate the absolute path (with http://..) to avoid this. But for me this is not a good solution, specially when you want to use a reverseproxy in front.
The image path is relative to current database by default.
Add "/.ibmxspres/domino/" in front of your image path to make it relative to Domino server's data directory instead.
Example:
Application path: /apps/hr/hr.nsf
Image database path: /core/images.nsf
<xe:basicLeafNode
...
image="/.ibmxspres/domino/core/images.nsf/yourImage.gif">
In case the image database is in same directory like your application database you can set image's path relative to current database path.
Navigate from application database path back to common directory with /.. and then to your database.
<xe:basicLeafNode
...
image="/../images.nsf/yourImage.gif">

Server MapPath not working on remote server

I am using Server.MapPath to find the path for a document uploaded to a remote server, so that I can then open it. However when using it, it is returning a relative path and so rather than searching the remote server it is searching the local machine instead.
What I am using to open the document is:
System.Diagnostics.Process.Start(Server.MapPath(Path.Combine("~/", document)));
Where "document" is the part of the path relative to the document itself, in this case "Files\2016\11\doc_name". So I want to take the path of this document, go to the top level of the site, and then find the document from there.
However I would hope that this would return a path similar to "server\inetpub\site\Files\2016\11\doc_name" but instead it is returning a path like "d:\inetpub\site\Files\2016\11\doc_name".
Can someone help me with what is the correct function to use to get the path I need?
EDIT
I have managed to fudge together the correct path using the following code:
string server = Environment.MachineName;
string path = Server.MapPath(Path.Combine("~/", documentpath));
System.Diagnostics.Process.Start(#"\\" + server + path.Substring(path.IndexOf(#"\")));
However, while I can get this to access the file when I'm running the project locally, it errors when I try to do it on the published site. As I can access it in one way, I'm assuming that it could be permissions (just to note the site is using windows authentication). Is this the most likely cause?

How to set the file upload path in liferay portlet so that it can be stored either in unix or windows system(machine independent)?

The suggestions were giving the path as catalina_home or user/home.
Do I need to set any parameters in server.xml?
And using actionRequest.getPortletSession().getPortletContext().getRealPath("/"); I am unable to store the file path in database.
Properties properties=PortalUtil.getPortalProperties();
String serverHome = properties.getProperty("liferay.home");
//To get the liferay server home folder
create any folder for uploaded files under it.

Resources