fear126 Posted May 15, 2015 Share Posted May 15, 2015 I m using that following code but idk image is getting unable to upload $Destination = 'assets/images/avatar/'; if(!isset($_FILES['ImageFile']) || !is_uploaded_file($_FILES['ImageFile']['tmp_name'])) { die('Something went wrong with Upload!'); } $RandomNum = rand(0, 9999999999); $ImageName = str_replace(' ','-',strtolower($_FILES['ImageFile']['name'])); $ImageType = $_FILES['ImageFile']['type']; //"image/png", image/jpeg etc. $ImageExt = substr($ImageName, strrpos($ImageName, '.')); $ImageExt = str_replace('.','',$ImageExt); $ImageName = preg_replace("/\.[^.\s]{3,4}$/", "", $ImageName); //Create new image name (with random number added). $NewImageName = $ImageName.'-'.$RandomNum.'_'.$membername.'.'.$ImageExt; move_uploaded_file($_FILES['ImageFile']['tmp_name'], "$Destination/$NewImageName"); Please help Quote Link to comment https://forums.phpfreaks.com/topic/296337-uploading-image-error/ Share on other sites More sharing options...
CroNiX Posted May 15, 2015 Share Posted May 15, 2015 (edited) Before going through the code, does the "assets/images/avatar/" directory that the file is being uploaded to have write permissions for the web user? Edited May 15, 2015 by CroNiX Quote Link to comment https://forums.phpfreaks.com/topic/296337-uploading-image-error/#findComment-1511996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.