Forum Moderators: coopster

Message Too Old, No Replies

Adding an extension to a variable

tried and failed

         

mcjohnson

10:43 am on Jun 27, 2007 (gmt 0)

10+ Year Member



Hello,

I am trying to pull images from a folder that are sent there by the CMS without extensions. I am trying to add the extension back onto the end to display them.

file name in the folder, for example, is "abc123"

I am defining the file as "$new"

I want to add ".jpg" to "abc123".

$image = ($new, '.jpg'); did not work

$image = ($new.jpg); did not work

I've trued multiple other options. Any suggestions?

Thanks,

Pat

Habtom

10:50 am on Jun 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should do it:

$new="abcd";
echo $new.".jpg";

will give you out the following:
abcd.jpg

Habtom

henry0

11:22 am on Jun 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hmmm, and what about find a way to make your CMS doing the job as it should?
or any reasons for not?