Re: Having trouble writing/copying/renaming file to sub-directory [message #170967 is a reply to message #170966] |
Mon, 13 December 2010 04:49 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 12/12/2010 11:25 PM, Robert Maas, http://tinyurl.com/uh3t wrote:
> 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.
What's the userid php is running under?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|