Solved

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

Posted on 2016-08-17
1
59 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now