Solved

php, need file path but starting at domain and user account, not complete path from server

Posted on 2016-08-17
1
71 Views
Last Modified: 2016-08-17
I have the following php code:

echo dirname(__DIR__).$file['name']

Open in new window


which returns:

/var/www/vhosts/zenbinder.com/httpdocs/vault/includeIMG_4300.JPG.jpeg

But I need it to return:

http://zenbinder.com/vault/smithmike/IMG_4300.JPG.jpeg

FYI -- the "smithmike" is already being stored in a php variable "$username" so we can pull it from there
0
Comment
Question by:edavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
edavo earned 0 total points
ID: 41760484
Since the domain and basic path was static, I found on another site, just keep it simple and use a static path, until you need to call the dynamic user and file. Much simpler than I thought.

<?php echo "http://www.zenbinder.com/vault/".$username."/".$file['name']?>
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question