Jump to content

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


dlc

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.