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)){ //Добавление в базу } } } 
  • Try in the 2nd and 3rd lines to add to "/ images / full /" / .. what would happen "/../images/full" - Andy

1 answer 1

If you have access to bash and do not want to change the main code, suppose you have several subdomains that work with 1 base of pictures, then you can forward the symlink, being in the folder / m / execute:

 ln -s <target folder> 

pointing to the location of the <target folder> path to the desired folder. After that, all that will be poured into the folder will fall into /m/images/ will actually be in /images/

https://ru.wikipedia.org/wiki/Character_link

  • Is the code variant possible? To prevent unnecessary actions when installing the site ... Well, according to your version, if you download from the main domain, they will turn out to be in / m / images /? - Albert Ushakov
  • Everything will fall into 1 folder, it's just a link. And in the code, if in the first answer they wrote /../images/ - Redr01d