ziedinjsh Posted January 10, 2012 Report Share Posted January 10, 2012 Sveiki! Ir tāda lieta, ka iekš datubāzes viss saglabājas, bet song un cover netiek augšupielādēti! <?php include("../misc/dbase.php"); if(isset($_POST['addsong'])){ $mp3 = "../mp3/"; $jpg = "../cover/"; $mp3_error = mysql_real_escape_string($_FILES['song']['error']); $mp3_name = mysql_real_escape_string($_FILES['song']['name']); $mp3_tmp = mysql_real_escape_string($_FILES['song']['tmp_name']); $jpg_error = mysql_real_escape_string($_FILES['cover']['error']); $jpg_name = mysql_real_escape_string($_FILES['cover']['name']); $jpg_tmp = mysql_real_escape_string($_FILES['cover']['tmp_name']); $artist = mysql_real_escape_string($_POST['artist']); $title = mysql_real_escape_string($_POST['title']); $duration = mysql_real_escape_string($_POST['duration']); $song = $mp3.basename($mp3_name); $cover = $jpg.basename($jpg_name); if($mp3_error==0 || $jpg_error==0){ move_uploaded_file($mp3_name, $song); move_uploaded_file($jpg_name, $cover); mysql_query("insert into songs (song, cover, artist, title, duration) values ('$mp3_name', '$jpg_name', '$artist', '$title', '$duration')") or die(mysql_error()); echo "jeej"; }else{ echo "fuu"; } } echo " <form method='post' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'> <p>Izpildītājs</p> <p><input type='text' name='artist'></p> <p>Nosaukums</p> <p><input type='text' name='title'></p> <p>Garums</p> <p><input type='text' name='duration'></p> <p>Bilde</p> <p><input type='file' name='cover'></p> <p>Dziesma</p> <p><input type='file' name='song'></p> <p><input type='submit' name='addsong' value='jou'></p> </form> "; ?> kapēc tā? Quote Link to comment Share on other sites More sharing options...
briedis Posted January 10, 2012 Report Share Posted January 10, 2012 (edited) move_uploaded_file($mp3_tmp, $song); move_uploaded_file($jpg_tmp, $cover); Edited January 10, 2012 by briedis Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted January 11, 2012 Author Report Share Posted January 11, 2012 kā yad var augšupielādēt divus failus vienā laikā, bet atsevišķos folderos? Quote Link to comment Share on other sites More sharing options...
Kavacky Posted January 11, 2012 Report Share Posted January 11, 2012 Izlasi kārtīgi, ko katrs parametrs nozīmē un padomā. (facepalm) 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.