Hi,
I think my host updated PHP, now my script doesn't work, need to get it back asap.
Can you see anything wrong in this?:
After that code it goes onto putting the image in it's folder. The problem is that no matter what you'll get the echo after "if (empty($userfile)) {" displayed on the screen and the script won't go any further
Thanks very much in advance
Craig.
I think my host updated PHP, now my script doesn't work, need to get it back asap.
Can you see anything wrong in this?:
Code:
function RandString(){
$keyChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$length = 8;
$resultKey = "";
for ($i=0;$i < $length; $i++)
$resultKey .= substr($keyChars, rand(1, strlen($keyChars) ), 1);
return $resultKey;
}
$rands = RandString();
include "db.php";
if (empty($userfile)) {
echo "There was no file entered or the file you tried to upload was too big. <br><a href='index.php'>Click here</a> to return to the index.";
} else {
$validMimes = array(
'image/png' => '.png',
'image/x-png' => '.png',
'image/gif' => '.gif',
'image/jpeg' => '.jpg',
'image/pjpeg' => '.jpg',
'image/bmp' => '.bmp'
);
if(!array_key_exists($_FILES['userfile']['type'], $validMimes)) {
die('Sorry, but the file type you tried to upload is invalid; only images are allowed.');
}
After that code it goes onto putting the image in it's folder. The problem is that no matter what you'll get the echo after "if (empty($userfile)) {" displayed on the screen and the script won't go any further
Thanks very much in advance
Craig.
Last edited: