Sunday, September 5, 2010

unlink function throws "permission denied" error

hi,

this permission denied thing seems ridiculous to me...since i use it
in different code and it works.
it works here, when i use this code to copy files.

$biguploaddir = "linkables/".$folderName; // the /big/ directory
if(!is_dir($biguploaddir)) mkdir($biguploaddir,true);

$bigsource = "link/tmp/".$folderName."/".$filename_big;
$bigdestination = "link/".$folderName."/".$filename_big;


//first copy image from temp to real location then delete all
directories and files in temp
if (!copy($bigsource, $bigdestination)){
print "Dein Flyer konnte nicht gespeichert werden";
}else{
unlink($bigsource);
}


now i need to copy whole directories and i had to use different code
for that:

$source = "link/tmp/".$folderName."/attachments";
$destination = "link/".$folderName."/attachments";

if ( is_dir( $source ) ) {
@mkdir( $destination );
$directory = dir( $source );
while ( FALSE !== ( $readdirectory = $directory->read() ) ) {
if ( $readdirectory == '.' || $readdirectory == '..' ) {
continue;
}
$PathDir = $source . '/' . $readdirectory;
if ( is_dir( $PathDir ) ) {
copy_directory( $PathDir, $destination . '/' . $readdirectory );
continue;
}
copy( $PathDir, $destination . '/' . $readdirectory );
}

//$directory->close();
}else {
copy( $source, $destination );
}

unlink($source);

were talking about the same path here...but cakephp wont unlink my
source folder...the copying works fine...just the files in the folder
wont get deleted...

how does that make sense?

thx

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: