Strict Standards: Only variables should be passed by reference in C:\xampp\htdoc

This message looks like to me that I am trying to post a variable that is unaccepted.

anyway pls have a look and see what you think

<?php if (isset($_FILES['image'])){ //has the form been submitted. $errors = array(); // define a variable called errors // what errors is going to do firstly is check the extension of file uploaded and then the size if any problems we are going to put the errors into an array $allowed_ext = array('jpg', 'jpeg', 'png', 'gif', 'png', 'bmp'); // all these are allowed file extensions $file_name = $_FILES['image']['name']; //file_name = image and the name of the file $file_ext = strtolower(end(explode('.', $file_name))); //file extension will all be converted to lowercase file ext starting after period of the variable file_name $file_size = $_FILES['image']['size']; //file size of image $file_tmp = $_FILES['image']['tmp_name']; //variable tmp_name gets the image and then applies a temp name //now we are going to write the code that will allow this form to process //print_r($_FILES);//this will place the uploaded file into an array(a symtematic arrangement of objects) // what we are doing is checking that the file type is correct in the upload and check the size of file also. // in the array it will stipulate the temp file name which is where the file has been uploaded to // so what we actually want to do in php is move this to a folder of our choice. if (in_array($file_ext, $allowed_ext) === false) { $errors[] = 'Extension not allowed'; // if in the array the file ext equals the variable not allowed then show the below error meassge } if ($file_size > 2097152 ) { $errors[] = 'File size must be under 2-megabytes'; } if (empty($errors)){ }else { foreach ($errors as $error) { // for each element we are looping and we are going to call each element error echo $error,'
'; } } } ?>

This was answered in your original topic

Sponsor our Newsletter | Privacy Policy | Terms of Service