Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 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