Hello. The task is this. There is a folder on the local computer. It is necessary to take certain photos and upload them to the site via php. THOSE. I used to implement it like this.

<form method="POST" action="/add_image" enctype="multipart/form-data"> <input name='file[]' type='file' multiple='true' class="add_photo_input" /> <input type="submit" name="add" value="Добавить" /> </form> //Обработчик if (isset($_FILES)) { //пролистываем весь массив изображений по одному $_FILES['file']['name'] as $k=>$v foreach ($_FILES['file']['name'] as $k=>$v) { //Назначаем имя изображения //Проверка расширений загружаемых изображений if($_FILES['file']['type'][$k] == "image/gif" || $_FILES['file']['type'][$k] == "image/png" || $_FILES['file']['type'][$k] == "image/jpg" || $_FILES['file']['type'][$k] == "image/jpeg") { //черный список типов файлов $blacklist = array(".php", ".phtml", ".php3", ".php4"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES['file']['name'][$k])) { //echo "Нельзя загружать скрипты."; exit; } } //перемещаем файл из временного хранилища if (move_uploaded_file($_FILES['file']['tmp_name'][$k], $uploadfile)) { //получаем размеры файла $size = getimagesize($uploadfile); //проверяем размеры файла, если они нам подходят, то оставляем файл if ($size[0] < $pic_weight && $size[1] < $pic_height) { //я обычно заношу пути к изображениям в бд } else { unlink($uploadfile); } } } } } 

So, and if, instead of downloading, I indicate the path, then I need that he take a photo along this path from the local computer and the load. How to do it?

  • one
    A browser without an explicit choice of a file by the user should not send it to the site. Otherwise, we get a huge security hole. - Visman
  • Well, I choose, or rather indicate the path to the file, before I chose the photo, but now I’m stupidly writing the path to the file, and I need to upload it - duddeniska
  • @duddeniska without a user action (as indicated by Visman) nothing will happen ... "choosing a file" and "pointing the way" are two different things! - Arsen
  • one
    @duddeniska also says that this parsing is done from the source site (donor) ... I didn’t notice the possibility of downloading a file from a local computer !! Perhaps there is immediately configured FTP access to the hosting where files are saved, etc. And yet, if this is a program that can be downloaded, works on WINDOWS, then of course the program itself already has access to the local folders of the computer ... but this does not apply to PHP - Arsen
  • one
    Well, for me this program is not known at all)) I just know the logic .... well, if the software saves pictures on the computer, this means that the program is written for WINDOWS and of course it can do these actions, but as already written it is not related to PHP you cannot do the same actions using PHP) - Arsen

0