The bottom line is, there are two fields on it, the first to select the file you want to upload to the server, the second to indicate the link to the file (its location on the server), I do two checks on the parameters received, and perform certain actions, the fact is then, the first check does not want to work ...
here is the code
<?php //определяю дерриторию скрипта $uploaddir = $_SERVER['SCRIPT_FILENAME']; $uploaddir =str_replace('index.php','',$uploaddir); ?> <form enctype='multipart/form-data' action='' method=post> <input type=file name="userfile" size=50><br> <input type="text" name="userfile2" size="50" value="<? echo $uploaddir.'news.txt'; ?>"><br> <input type=submit value="Поехали"> </form> <?php //Вывел форму с двома полями, первое для выбора фала с компа, второе чтобы указать иммя файла на сервере //проверяю первое значение, указан ли файл на с компа, если да, загружаю его на сервер, и вывожу его адрес, прекращаю выполнение скриптиа if (isset($_POST["userfile"])){ $temp=$_FILES['userfile']['name']; $uploadfile = $uploaddir . $temp; move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); echo $uploadfile.'<br>'; exit; } //проверяю второе значение, указан ли файл на с сервере, если да, загружаю его на сервер, и вывожу его адрес, прекращаю выполнение скриптиа if (isset($_POST["userfile2"])){ $url = $_POST["userfile2"]; echo $url.'<br>'; $contents = file_get_contents($url); exit; } ?>
The first if (isset ($ _ POST ["userfile"])) check doesn’t give any result, and all the time it outputs me a file that is already on the server ...
where I made a mistake ... thanks in advance!