Anyone know how to set image move location using user field from mysqrl database.
I want user to select an account type.
I want image to be stored in user folder.
I don’t know how to write the code for the path, so I need help to write the path to user folder.
path should be:
$add=“members/accountType/userid_firstname/profilePic/$file_name”;
any help will be great…Thanks
My upload image code:
$file_upload=“true”;
$profile_pic_size=$_FILES[‘file_up’][size];
if ($_FILES[profile_pic][size]>1000000){$msg=$msg.“Your uploaded file size is more than 1,000KB so please reduce the file size and then upload!
”;
$file_upload=“false”;}
if (!($_FILES[profile_pic][type] ==“image/jpeg” OR $_FILES[profile_pic][type] ==“image/gif”)){$msg=$msg.“Your uploaded file must be of JPG or GIF. Other file types are not allowed!
”;
$file_upload=“false”;}
$file_name=$_FILES[profile_pic][name];
$add=“members/accountType/id_firstname/profilePic/$file_name”;
// the path with the file name where the file will be stored, upload is the directory name.
if(file_exists($add)){$msg2=$msg2.“Profile picture already upload!”;
}else{$msg2=$msg2."Sorry no profile picture at! $add ";}
if($file_upload==“true”){
if(move_uploaded_file ($_FILES[profile_pic][tmp_name], $add)){$msg=$msg.“Your profile was picture sucessfully upload.
”;
}else{echo “Failed to upload file Contact Site admin to fix the problem!”;}
}