I'm working under Windows XP (Apache + PHP), if I use FileSize() with a local path it works fine, but not when passing a path in a shared folder in my network like:
PHP Code:Echo FileSize("\\Anothercomputer\Sharedfolder\Filename.txt");
Printable View
I'm working under Windows XP (Apache + PHP), if I use FileSize() with a local path it works fine, but not when passing a path in a shared folder in my network like:
PHP Code:Echo FileSize("\\Anothercomputer\Sharedfolder\Filename.txt");
the backslash ("\") is an escape character in PHP. To PHP, you're trying to open:
try:Code:\AnothercomputerSharedFolderFilename.txt
in each instance where you want a backslash, you must escape it using the backslash ("\\").PHP Code:echo filesize("\\\\Anothercomputer\\Sharedfolder\\Filename.txt");
You can find out more about Strings here: http://www.php.net/manual/en/language.types.string.php
This doesn't work for shared folders on other computers, any known trick for this?
You can use single quoted strings as well.
I don't know of any reason why you wouldn't be able to call filesize for a file over SMB.PHP Code:filesize('\\who\where')
I don't know why you would want to give your web server access to resources via SMB. I would much prefer to lock it away in the furthest corner of the network possible. ;)
I'm developing an interface that takes data from a MySql database in a given server and it creates an output file also in that server all this is done using MySql, now the part i need to do using PHP is opening this file, see how many bytes it is, writing that number to other file (a control file) and finally zipping it to gz. All this is already done and working but to make it work i had to copy that output file generated by MySql to my computer and then running my php file. I wanted to simplify my developing a bit by making my php file work directly with the file in the server, and this file was in a shared folder in the server.
But: I'm thinking that this PHP file i'm working with locally, will be in that server when all this becomes productive, since this interface will run scheduled most of the times with a CRON task.
Why do they use PHP? maybe they want to call this via web? i don't know. I just know this is how they want these interfaces and i'm now just learning about all this web stuff since most of my experience has been desktop applications till now.
Marking thread resolved, Thank you all. :)