Jump to content

Strict Standards: Only variables should be passed by reference in...


Recommended Posts

Hello,

 

I have a "working" upload script but i do get an error:

 

Strict Standards: Only variables should be passed by reference in C:\Users\UHN\Desktop\xampp-win32-1.7.4-VC6\xampp\htdocs\upload.php on line 99

 

Line 99:

$file_ext = strtolower(end(explode('.', $file_name)));

 

thanks..

 

I will put some more code to make ik clearer.

 

if($_SERVER['REQUEST_METHOD'] == "POST") {

$input_name = $_POST['filename']; // The given name

        $file_name = $_FILES['filen']['name']; // The file name of the uploaded file

        $file_ext = strtolower(end(explode('.', $file_name))); // Get the extension

......

 

 

I get:

 

Warning: substr() expects at least 2 parameters, 1 given in C:\Users\UHN\Desktop\xampp-win32-1.7.4-VC6\xampp\htdocs\upload.php on line 100

 

Warning: strtolower() expects exactly 1 parameter, 2 given in C:\Users\UHN\Desktop\xampp-win32-1.7.4-VC6\xampp\htdocs\upload.php on line 100

 

line 100 is:

$file_ext = strtolower(substr($file_name), -(strpos($file_name, '.')+1));

 

Now i have a new error:

 

Notice: Undefined variable: extensioncheck in C:\Users\UHN\Desktop\xampp-win32-1.7.4-VC6\xampp\htdocs\upload.php on line 116

$extensioncheck is an array holding multiple extensions including " .pdf "

 

If i use print_r($file_ext); i get:

np.pdf

 

The original name is aannp.pdf

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.