I have the below script and when its ran I get an error about Strict Standards, could someone help at all? I am trying to set the current timestamp as the filename so that too.
<br /> <b>Strict Standards</b>: Only variables should be passed by
reference in
<b>/home/user/public_html/domain.com/upload.php</b>
on line <b>15</b><br /> Upload: screenshot-05.png<br />Type:
image/png<br />Size: 49.2109375 Kb<br />Stored in: uploads/1401352853
PHP
if(empty($_FILES['file'])) {
exit();
}
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png" && $_FILES["file"]["size"] < 2500000 && in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "<br />";
} else {
$unixtime = time();
$fname = 'uploads/'. $unixtime;
move_uploaded_file($_FILES["file"]["tmp_name"], $fname);
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $fname;
}
} else {
echo "Invalid file type";
}
Edit: Line 15 is -> $extension = end(explode(".", $_FILES["file"]["name"]));