Jump to content

bemused


rarebit

Recommended Posts

I have a directory where users can upload an image, this is given their username.

When used, it is checked to see if it exists:

$img = "<img src='"._SEP.$site_data['dir_path'].$file_dir.$uname.".gif' alt='VOID'>";
if (!file_exists($file_dir.$uname.".gif"))
{
$img = "No Image";
}

However, if there is no username then an image is shown anyway, there is no image name '.gif' in the folder, even though it shows another image from somewhere else. Is this a peculiarity of 'file_exists()' (maybe using stat), or what.

 

If before all of this I put:

if(strcmp($uname, "")==0)	{	$uname = "VOID";	}

then it works as expected...

 

This just seems to be an extra unwanted step!

 

 

Sorry about this post, sort of solved it as it was written...

Link to comment
https://forums.phpfreaks.com/topic/106077-bemused/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.