Why not save files on the server?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
13 views
<?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?
by | 13 views

1 Answer

0 like 0 dislike
Right checked?
by

Related questions

0 like 0 dislike
1 answer
asked Apr 22, 2019 by VitaliyBorys
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 23, 2019 by pritchin_maxim1
0 like 0 dislike
1 answer
0 like 0 dislike
7 answers
110,608 questions
257,187 answers
0 comments
40,796 users