Auto copy file

Hello all,

So I’ll first explain what I’m trying to do. So I’m making a CMS with photo-uploading capabilities, and therefore the creation of new albums (as beeing folders whereto the pictures get uploaded). But in order to make this folder an album there also should be a php-file uploaded when it was created, so I thought the copy function would allow me to do so, but it doesn’t work.

[php]

<? $NewOrOld = $_POST['dir']; $NewName = $_POST['NewName']; $path = "../../foto/albums/"; if ($NewOrOld == 1) { mkdir($path.$NewName); $dir = $NewName; } elseif ($NewOrOld == 2) { if (file_exists($path.$_POST['DirName'])) { $dir = $_POST['DirName']; } else { print 'Het geselecteerde album bestaat niet!'; } } //This is where the copying of the file should happen $target_path = $path.$dir; $template = "template/index.php"; copy($template, $dir); foreach ($_FILES['filesToUpload'] as $file) { print "".$file['name']."
"; print "".$file['type']."
"; print "".$file['size']."
"; } print ''; ?>

[/php]

Any Ideas?

Ps. I know it will not upload like this but I’m still working on the upload code. And I’m sure the link to the template/index.php is correct beacuse if I include it for testing, it works

Greets

Yoram

Sponsor our Newsletter | Privacy Policy | Terms of Service