Hello,
I am using this code to upload a file to my server. The code works in the sense that it is uploading the file successfully, including preventing uploads with wrong extensions … however every time I upload a file I get the following error
Strict Standards: Only variables should be passed by reference in C:\upload.php on line 8
Below is my code, I have marked line 8. Any ideas??? Thanks in advance
<?php
$message = '';
$target_path = "C:\\mypathhere";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$file = $_FILES['uploadedfile']['name'];
$allowed_ext = array('csv','txt','rtf');
$actualext = end(explode(".", $file)); // Line 8
if( $file > 1111111){
$message = 'File over 1111111 bytes';
} if ($message == NULL && !in_array($actualext, $allowed_ext)){
$message = 'File extension not allowed';
} if($message == NULL){
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename($file)." has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
echo $message;
?>