$config['BaseUrl'] QUESTION

I have a line of code that reads:

$userid = 'moffit';
$config['BaseUrl'] = '.s166067.gridserver.com/'.$userid.'/assets/';

This code is part of a script that uploads an image into the assets directory. But the image is NOT being shown on the page because the code is returning:

moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

AND IT NEEDS TO BE THIS:

http://moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

HOW CAN I GET THE CODE TO ADD THE "HTTP://" in front?
edavoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
I don't know that it matters since neither one is a valid URL.  But the 'http://' needs to be added where it is used and that is somewhere else in your code.
0
Ahmed MerghaniSoftware EngineerCommented:
Where is the part of the code that generate /return "moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif" ??
Or there will be some where host variable or something is set to "moffitlake.org" just add "http://" before.
0
Ray PaseurCommented:
HOW CAN I GET THE CODE TO ADD THE "HTTP://" in front?
Use PHP string concatenation like this:

$x = 'http://' . $config['BaseUrl'] . /* WHATEVER */;

I think you need a professional developer.  There is a back-story to this question and to the PHP code in the web site that a professional would probably understand fairly quickly.  But from the question it almost looks like you've got some code you did not understand, but you installed it anyway.  And that is a recipe for certain catastrophe.

This URL is 404
http://moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

It looks like it is made up from this:
$config['BaseUrl'] = '.s166067.gridserver.com/'.$userid.'/assets/';

By doing something like this:
$_SERVER['HTTP_HOST'] . $config['BaseUrl'] . '2_ad_facebook.gif';

Then you would use string concatenation to prepend the protocol name to the front of the URL.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Ray PaseurCommented:
0
edavoAuthor Commented:
I will look into this further and check the validation per your comments. I appreciate your patience and advice. I will report back soon. Sincerely - d
0
Ray PaseurCommented:
Any progress in the last month?
0
Ahmed MerghaniSoftware EngineerCommented:
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.