hi all i have got a problem with my profile photo upload script after converting to mysqli everytime i go to upload a image i get the following error:

Strict Standards: Only variables should be passed by reference in /home/matureco/public_html/registration2.php on line 11

and the code for that section is as follows:

//For Uploading Profie pic
if(isset($_POST['sub1']))
{
    //$fn   = date('U').$_FILES['userimage']['name'];
    $ext    = end(explode('.',$_FILES['userimage']['name'])); ---THIS LINE---
    $fn     = date('U').".".$ext;
    $ft     = $_FILES['userimage']['type'];
    $fs     = $_FILES['userimage']['size'];
    $ftmp   = $_FILES['userimage']['tmp_name'];
    move_uploaded_file($ftmp, "images/user_images/$fn");
    $thumb  = new Thumbnail('images/user_images/'.$fn);
    $thumb->resize(100,100);
    $thumb->save('images/user_images/smallthumb/'.$fn);
    $thumb1 = new Thumbnail('images/user_images/'.$fn);
    $thumb1->resize(405,540);
    $thumb1->save('images/user_images/bigthumb/'.$fn);

If anyone can give me a idea what it could be ty in advance jan x

Member Avatar for Zagga

Hi,

The problem is with the end() function. As mentioned in the PHP Manual, "This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference."

Try replacing line 5 with the following 2 lines to get the file extension using pathinfo()

$path_parts = pathinfo($_FILES['userimage']["name"]);
$ext = $path_parts['extension'];

sorry for delay but ty worked a treat :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.