0

I have tried a lot of things.

The lines of code;

$file_name1=$_FILES["image"]["name"];
$ext = strtolower(end(explode('.', $file_name1)));
if($ext!="jpg"&&$ext!="jpeg"&&$ext!="png"&&$ext!="tif"&&$ext!="gif")

The middle line being the line that is in "error" gets this error when trying to upload a picture, Fatal error: Only variables can be passed by reference

$ext = strtolower(end(explode('.', $file_name1)));

My guess is that it has to do with the version of php my hosting company has.


Can anyone suggest or come up with code that would work on the latest version of php.

my guess is its the end and explode that it has a problem with.

Also when I change the code to just

$ext = strtolower('.', $file_name1); I get an error about the '.'

:-\ ??? :o any help would make my me :D

4
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by nav33n
0

>My guess is that it has to do with the version of php my hosting company has

So have you tried that, with your version of php and has it worked?

0

Try:
$extension = explode(".", $filename);
$extension = $extension[sizeof($extension)-1];

Which should return the file extension.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.