I have a code like this below, which gives me a $link that equals to: http://mydomain.com/image/photo.JPG
if (!empty($_SESSION['item'][$i]))
{
$path = dirname(__FILE__).'/image/'.basename($_SESSION['item'][$i]);
if (move_uploaded_file($_SESSION['item'][$i], $path))
global $url;
if ( $url )
{
$link = $url.'/image/'.basename($_SESSION['item'][$i]);
echo "<td><img src='" . $link . "' width='50' height='50' /></td>";
}
}
I wonder, how should I properly ommit using global variable here to achieve the same result.
UPDATE
if (move_uploaded_file($_SESSION['item'][$i], $path))
{
$link = 'image/'.basename($_SESSION['item'][$i]);
echo "<td><img src='" . $link . "' /></td>";
}
This modification doesn't show any letter. It seems that if block doesn't execute.