There is the usual form of loading on the subdomain. Code below. How to make files uploaded to the previous folder, that is / images / and not / m / images /?
$final_width_of_image = 500; $path_to_image_directory = $_SERVER['DOCUMENT_ROOT']."/images/full/"; $path_to_thumbs_directory = $_SERVER['DOCUMENT_ROOT']"/images/thumbs/"; $extension = strtolower(substr(strrchr($_FILES['avatar']['name'], '.'), 1)); if(trim($extension)){ $filename = substr(md5(microtime() . rand(0, 9999)), 0, 20) .'_avatar.'. $extension; $source = $_FILES['avatar']['tmp_name']; if(preg_match('/.+\.(jpe?g|png|gif)/is', $_FILES['avatar']['name'])){ if($_FILES['avatar']['size'] != 0 AND $_FILES['avatar']['size']<=10000000){ $target = $path_to_image_directory . $filename; if(move_uploaded_file($source, $target)){ //Добавление в базу } } }