<?php// ограничение размера файла$limit_size = 1*1024*1024; // 1 Mb// корректные форматы файлов$valid_format = array("jpeg", "jpg", "gif", "png", "pdf");// хранилище ошибок$error_array = array();// путь до нового файла$path_file = "files/";// имя нового файла$rand_name = md5(time() . mt_rand(0, 9999));// если есть отправленные файлыif($_FILES){// валидация размера файлаif($_FILES["upload_file"]["size"] > $limit_size){ $error_array[] = "file Size exceeds allowed!"; } // validate file format $format = end(explode(".", $_FILES["upload_file"]["name"])); if(!in_array($format, $valid_format)){ $error_array[] = "file Format is not valid!"; } // if no error occurred if(empty($error_array)){ // check whether the uploaded file if(is_uploaded_file($_FILES["upload_file"]["tmp_name"])){ // save the file move_uploaded_file($_FILES["upload_file"]["tmp_name"], $path_file . $rand_name . ".$format"); }else{ // If the file is not loaded $error_array[] = "upload Error!"; } } } ?>
<?php if(!empty($error_array)): ?>The file is not uploaded!
<?php foreach($error_array as $one_error): ?><?=$one_error;?>
<?php endforeach; ?><?php endif; ?><?php if(empty($error_array) AND $_FILES): ?>The file has been successfully uploaded!
<?php endif; ?>
,
Hosting works flawlessly on a physical server writes that the file is downloaded but in the folder it is not, what could be the reason?