dreamerdevos Posted December 1, 2007 Share Posted December 1, 2007 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 '.' :-\ ??? any help would make my me Link to comment https://forums.phpfreaks.com/topic/79647-solved-fatal-error-only-variables-can-be-passed-by-reference/ Share on other sites More sharing options...
toplay Posted December 1, 2007 Share Posted December 1, 2007 The end() function requires a variable to be specified as an argument. $file_name1=$_FILES["image"]["name"]; $ext = explode('.', $file_name1); $ext = strtolower(end($ext)); ... See: http://us2.php.net/manual/en/function.end.php Link to comment https://forums.phpfreaks.com/topic/79647-solved-fatal-error-only-variables-can-be-passed-by-reference/#findComment-403371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.