The thing of it is that this line:
$check = @fopen("$referer/$phpurl/createtable.php","r");
must check out ok and it's before the line that's failing. So this means that you can open a file via the file's URL. So knowing that then the next file that's opened:
$check = @fopen("$referer/$images/flat.gif","r");
Should work. But this is failing. Since both lines share the $referer variable we can eliminate that. All that is left is the $images variable and the flat.gif file. Do you have an extra trailing slash / at the end when setting up the image information? We know that the flat.gif file does exist and is uploaded to the directory so all that remains is the $images variable.
My guess is that the information for that variable needs to be adjusted.
