[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	since you are using the server to copy the file, and the copy succeeds, 
the server obviously has at least read access to the source.
You just can't get the permissions right.  Check out: 
.  If you have access 
to your server or another *nix machine also check out "man umask".  If 
you set your umask before the copy, your file should be copied with the 
right permissions.  If you set the umask after the copy, you should be 
able to chmod.  Be careful how you set the umask, it's not as straight 
forward as is seems.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  -->  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	I assume that you are using your server to copy the file, and since the 
copy apparently suceeds, your server must have read access to the source 
file.  Check out
.  If you set the 
correct umask prior to your copy, your copied file should end up with 
the correct permissions.  Even if it doesn't, you should be able to 
chmod correctly.  Be careful with the mask, it is set up with negative 
logic.  If you have access to an *nix system, try a "man umask" for more 
information.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  -->  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: File Copy

2002-03-01 Thread Henrik Hansen

[EMAIL PROTECTED] (Andy Delcambre) wrote:

 > I am a complete php newbie but i have a quick question.  I was wondering if
 > there is a way to copy a file from a remote site to your local server?  I
 > want to grab a picture off of a site and store it locally to be displayed
 > later. Thanks alot,


use the fopen function to save the image to your local site, ex:

$fp = fopen("http://site.com/image.gif";, "r");
$buffer = "";
while (!feof ($fp)) {
$buffer .= fgets($fp, 4096);
}
fclose($fp);

$fp = fopen("/local/file.gif", "wb");
fwrite($fp, $buffer);
fclose($fp);

untested but it should work (TM).

-- 
Henrik Hansen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php