2

I have a Warning on my php file at mkdir() function:

I want to make a folder on my server address so my code is like this:

<?php
    $link="\\10.44.96.4\\Arch\\down\\2018"
    mkdir($link, 0775, true);
?>

The real path is: \\10.44.96.4\Arch\down\2018
What I'm doing wrong?

Later Edit The solution can be found here: https://www.codedwell.com/post/21/reading-file-list-from-a-mapped-windows-network-drive

BOB
  • 700
  • 2
  • 16
  • 35
  • 4
    What is the warning ? – gogaz Aug 21 '18 at 11:59
  • `Warning: mkdir(): File exists in D:\apache\myfile.php on line 2` – BOB Aug 21 '18 at 12:00
  • 6
    Is that error message not ___SELF EXPLANATORY?___ – RiggsFolly Aug 21 '18 at 12:01
  • The code is running on server, and the directory I want is on another server – BOB Aug 21 '18 at 12:01
  • 2
    At the very least you'll need to double-escape the two leading backslashes – iainn Aug 21 '18 at 12:02
  • I think this 2 backslashes are the problem `\\10.44....` – BOB Aug 21 '18 at 12:05
  • Thats what @iainn said try `\\\\10.44....` – RiggsFolly Aug 21 '18 at 12:07
  • 2
    Can someone put me straight here. Are you allowed to create folders on another server as easily as this? I find it kinda hard to believe that you can! – RiggsFolly Aug 21 '18 at 12:08
  • @RiggsFolly I tried, and it says: Invalid argument... – BOB Aug 21 '18 at 12:11
  • Possible duplicate of [PHP directory list from remote server](https://stackoverflow.com/questions/1688564/php-directory-list-from-remote-server) – AmmoPT Aug 21 '18 at 12:14
  • @AmmoPT I'm not trying to access via ftp that server...It is a server where I put all my stuff when I'm working... – BOB Aug 21 '18 at 12:22
  • 1
    I am not sure that you can create folder in remote server, but if you are running this script on the same server than it is better to try relative pats – Davit Huroyan Aug 21 '18 at 12:44
  • @BOB, What you are trying to do is unheard of for almost everyone commenting here. If you are trying to create a folder on a remote server, you can use the `ftp_mkdir` function, which was created specifically for this purpose. https://www.w3schools.com/php/func_ftp_mkdir.asp – Rafael Aug 21 '18 at 12:59
  • The answer is to map the server location to a drive letter and after that I can create directories. Unfortunately I need administrator privileges for doing that. You can view the php script right here: `https://www.codedwell.com/post/21/reading-file-list-from-a-mapped-windows-network-drive` – BOB Aug 21 '18 at 14:05
  • It would be nice if you would post a complete answer to your question and add the information that you are working with Windows and Windows/SAMBA shares. – Rayne Aug 21 '18 at 14:22

0 Answers0