I am creating my own website at http://harrisonprograms.com and I have a problem on the profile page.
The problem is I have created a PHP script that will upload an image to the server for example the image directory might be Users/whatevertheusername/imagename.png and then add a string reference to it in MySQL on the users MySQL row. However before the script performs this it checks if the file uploaded is an image file using the substring function, I can't post an image because my reputation isn't high enough so here's the code in text
if(isset($_POST['SUBMITFILE2'])){
$imageName = $_FILES['UPLFILE2']['name'];
$imageData = file_get_contents($_FILES['UPLFILE2']['tmp_name']);
$imageType = $_FILES['UPLFILE2']['type'];
//VALIDATE WHETHER FILE IS AN IMAGE OR NOT
if(substr("$imageName", 0, 5) == 'image'){
The thing I can't understand is it used to work and validate if the file was an image or not but now it has stopped working and I don't know why.
– Harrison Pickering Sep 30 '14 at 21:14