0

$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));

http://www.tutorialspoint.com/php/php_file_uploading.htm <-- In this tutorial, the above statement checks whether a file extension is allowed according to the $expension definitions, but I get an error:

Strict Standards: Only variables should be passed by reference in /home/tstsit82/public_html/register.php on line 33

The code works, but this warning also outputs. What is the problem and solution?

Thanks

1 Answers1

1

In essence, what the error is saying is that you should have a variable that end() is being called on - not the return from another function (in this instance, explode).

To re-write that code without the error, you'd do:

<?php
$filearr = explode('.',$_FILES['image']['name']);
$file_ext=strtolower(end($filearr));
Liam Wiltshire
  • 1,254
  • 13
  • 26