Jump to content
php.lv forumi

funkcija copy uz dažādiem folderiem


Sephy

Recommended Posts

Labdien man ir kods ar sarakstu kurā var izvēlēties dažādus folderus bildes ievietošanai, bet man neizdodas pievienot izvēlēto vērtību copy funcijai. Ar manualu destination foldera uzrakstishanu strada!

 

<?php
//Saraksts ar folderiem
$galerijas = array(
'Pasakumi' => 1,
'Sports' => 2,
'Nu' => 3,
'Portreti' => 4
);

function generateSelect($name = '', $options = array()) {
$vieta = '<select name="'.$name.'">';
foreach ($options as $option => $value) {
	$vieta .= '<option value='.$value.'>'.$option.'</option>';
}
$vieta .= '</select>';
return $vieta;
}
//noteikt izveleto vertibu
$vieta = generateSelect('galerija', $galerijas); 
//fails ko upload
$image=$_FILES['image']['name'];

$filename = stripslashes($_FILES['image']['name']);

$size = filesize($_FILES['image']['tmp_name']);

//izvelamies galeriju
$newname = $vieta.$filename;
$copied = copy($_FILES['image']['tmp_name'], $newname);

Edited by Sephy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...