Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-08-17
1
Medium Priority
?
78 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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…

715 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