phq Posted July 2, 2008 Share Posted July 2, 2008 Goodday! This is my current code: #read first $data = implode("",file($source_file_path)); //equvilant to 'file_get_contents', all php4 dist. dont have this #write copy $f = fopen($target_file_path,"w"); fwrite($f,$data); fclose($f); #then change owner/group chown($target_file_path, $ownergroup); chgrp($target_file_path, $ownergroup); I manage to duplicate the file with the SAME permission as the source. But I can't run chown/chgrp. It says "Operation not permitted..." Any advice? Thankslots PHQ Link to comment https://forums.phpfreaks.com/topic/112945-how-to-copyduplicate-file-with-ownergroup-intact/ Share on other sites More sharing options...
lemmin Posted July 2, 2008 Share Posted July 2, 2008 Your web server probably doesn't have access to change permissions on that folder/file. Try changing the permissions of that folder. Link to comment https://forums.phpfreaks.com/topic/112945-how-to-copyduplicate-file-with-ownergroup-intact/#findComment-580184 Share on other sites More sharing options...
phq Posted July 2, 2008 Author Share Posted July 2, 2008 The folder permission is currently 777! ??? Link to comment https://forums.phpfreaks.com/topic/112945-how-to-copyduplicate-file-with-ownergroup-intact/#findComment-580440 Share on other sites More sharing options...
trq Posted July 2, 2008 Share Posted July 2, 2008 Whats wrong with copy() ? Link to comment https://forums.phpfreaks.com/topic/112945-how-to-copyduplicate-file-with-ownergroup-intact/#findComment-580445 Share on other sites More sharing options...
phq Posted July 3, 2008 Author Share Posted July 3, 2008 If I were to use copy, the copied file has a default permission of 0644 and I can't change it! Link to comment https://forums.phpfreaks.com/topic/112945-how-to-copyduplicate-file-with-ownergroup-intact/#findComment-580528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.