Sephy Posted July 3, 2011 Report Share Posted July 3, 2011 (edited) 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 July 3, 2011 by Sephy Quote Link to comment Share on other sites More sharing options...
marcis Posted July 3, 2011 Report Share Posted July 3, 2011 Ko tavuprāt satur mainīgais $newname ? ... //izvelamies galeriju $newname = $vieta.$filename; echo $newname; Quote Link to comment Share on other sites More sharing options...
Rincewind Posted July 3, 2011 Report Share Posted July 3, 2011 Pirms kopēšanas ieliec echo un apskaties kas tur ir (ja pareizi sapratu kodu tad tur nekā līdzīga ceļam nebūs) $newname = $vieta.$filename; echo $newname; Quote Link to comment Share on other sites More sharing options...
Sephy Posted July 3, 2011 Author Report Share Posted July 3, 2011 Labi neko es esmu bremze, tagad viss strada.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.