FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Having trouble writing/copying/renaming file to sub-directory
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Having trouble writing/copying/renaming file to sub-directory [message #170966] Mon, 13 December 2010 04:25 Go to previous message
seeWebInstead is currently offline  seeWebInstead
Messages: 14
Registered: October 2010
Karma:
Junior Member
Using the FTP program, I PUT the PHP script files, created some
sub-directories, including ReqSOAP, and PUT a file into the ReqSOAP
sub-directory. Excerpts of directory listings after that's been done:

ftp> dir
...
drwxr-xr-x 3 3237 vhosts 4096 Nov 20 23:41 Images
drwxr-xr-x 2 3237 vhosts 4096 Dec 11 02:10 RepSOAP
drwxr-xr-x 2 3237 vhosts 4096 Dec 13 10:56 ReqSOAP
...
-rw-r--r-- 1 3237 vhosts 20059 Nov 11 13:42 portal1.php
...
ftp> cd ReqSOAP
250 OK. Current directory is /ReqSOAP
ftp> dir
-rw-r--r-- 1 3237 vhosts 5 Dec 13 10:56 tmp.txt

Using PHP script, writing into my toplevel (default) directory
works, but that's not what I want, which is to write into a
sub-directory. (What's the point of making sub-directories if they
can't be used from PHP scripts??) Here's the key part of the script,
interleaved with the corresponding output:

$olddir = getcwd(); echo " old-dir: "; var_dump($olddir);
old-dir: string(46) "/www/blackapplehost.com/c/a/l/calrobert/htdocs"

echo " strlen=",strlen($outr20str)," ";
strlen=791

$filnam = $timst . ".txt"; echo " filnam: [",$filnam,"] ";
filnam: [1292127412.58842300.txt]

$dir = "ReqSOAP"; echo " is_dir: ",is_dir($dir)," ";
is_dir: 1

$filename = "$dir/$filnam"; echo " filename: [",$filename,"] ";
filename: [ReqSOAP/1292127412.58842300.txt]

$bytes = file_put_contents($filename,$outr20str); echo " f1: "; var_dump($bytes);
f1: bool(false)

$bytes = file_put_contents($filnam,$outr20str); echo " f2: "; var_dump($bytes);
f2: int(791)

$r = copy($filnam, $filename); echo " copy: "; var_dump($r);
copy: bool(false)

$r = link($filnam, $filename); echo " link: "; var_dump($r);
link: NULL

$r = unlink($filnam); echo " unlink: "; var_dump($r);
unlink: bool(true)

I've run out of ideas how to get my output into the ReqSOAP sub-directory.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to generate cryptographically-secure random big-integers?
Next Topic: PHP Guestbook list on PHPKode.com
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 21:45:08 GMT 2024

Total time taken to generate the page: 0.06127 seconds