Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8235435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:48:34+00:00 2026-06-07T18:48:34+00:00

I have a path to a folder (e.g. /var/www/tester/assets/themes/default/css/ ). a user can provide

  • 0

I have a path to a folder (e.g. /var/www/tester/assets/themes/default/css/).

a user can provide a relative path to the folder, so for example. layout/ie7.css would give the path of /var/www/tester/assets/themes/default/css/layout/ie7.css.

This works fine, however I want the users to be able to navigate up the directory tree as well.

so with the path to the css folder again if a user provides ../../cache/css/ie7.css I want the path to end up as /var/www/tester/assets/themes/default/cache/css/ie7.css.

I thought I could just pass them together to realpath() e.g:

$base = '/var/www/tester/assets/themes/default/css/';
$user_path = '../../cache/css/ie7.css';
$final_path = realpath($base.$user_path);

But that just returns false. How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:48:36+00:00Added an answer on June 7, 2026 at 6:48 pm

    first of all the real path function also checks whether the given path exists… Are you sure your path exists???

    /var/www/tester/assets/themes/default/css/../../cache/css/ie7.css 
    

    would not end up in

    /var/www/tester/assets/themes/default/cache/css/ie7.css 
    

    as you suggest but it ends up in

    /var/www/tester/assets/themes/cache/css/ie7.css 
    

    Does this folder with the given file exist?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that is symlinked from one folder to another /var/www/default/index.php which
I have some path c:\server\folderName1\another name\something\another folder\ . How i can extract from there
I am writing in php. I have the following code: $folder_to_zip = /var/www/html/zip/folder; $zip_file_location
I have my root folder set to /var/www/html , but I have php program
I have a folder path stored in the property nightly.basepath (here the value would
I have the local file path as c:\new folder\pdf\today\k.pdf I want to replace the
I have a Wordpress blog at http://themes.visualise.ca/visualise and when a user clicks on a
I have a cron task setup to run the following: php /var/www/vhosts/examplesite.com/index.php cron processCategoryItemCount
Suppose I have a directory structure like so /var/www └── test.js Probably the most
I have an assembly on a shared folder (UNC-path only, no mapped drive). When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.