PHP beginner |
|
Hallo ik heb een scirpt gekregen namelijk:
<form method="POST" action="" enctype="multipart/form-data">
<table border="0">
<tr>
<td>Film:</td>
<td><input name="film" type="file" class="form"/></td>
</tr>
<tr>
<td>Thumbnail:</td>
<td><input name="thumb" type="file" class="form"/></td>
</tr>
<tr>
<td>Categorie:</td>
<td>
<select name="cat" class="form">
<?php
$query = mysql_query("SELECT * FROM categorie");
while($result=mysql_fetch_assoc($query))
{
$catnaam = $result['naam'];
echo "<option value=\"".$naam."\">".$catnaam."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2"><p align="center"><input name="upload" type="submit" class="form" value="Upload uw film!"/>
</p></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['upload']))
{
$film = $_FILES['film']['name'];
$tmp_film = $_FILES['film']['tmp_name'];
$thumb = $_FILES['thumb']['name'];
$tmp_thumb = $_FILES['thumb']['tmp_name'];
$cat = $_POST['cat'];
$thumb_afmeting = getimagesize($tmp_thumb);
$thumb_x = $thumb_afmeting[0];
$thumb_y = $thumb_afmeting[1];
//uploaden
move_uploaded_file($tmp_thumb, "upload/".$cat."/".$thumb);
if($thumb_x > 200)
{
echo "De toegestane breedte voor een thumbnail is 200 pixels";
}
elseif($thumb_y > 150)
{
echo "De toegestane hoogte voor een thumbnail is 150 pixels";
}
else
{
move_uploaded_file($tmp_thumb, "upload/".$cat."/".$thumb);
}
$film_url = $cat."/".$film;
$thumb_url = $cat."/".$thumb;
$insert = "INSERT INTO films (categorie, film, thumbnail) VALUES ('".$cat."', '".$film_url."', '".$thumb_url."')";
if(mysql_query($insert))
{
echo "Het uploaden is succesvol afgerond";
}
else
{
echo "Het uploaden is mislukt";
}
}
?>
<form method="POST" action="" enctype="multipart/form-data"> <table border="0"> <tr> <td>Film:</td> <td><input name="film" type="file" class="form"/></td> </tr> <tr> <td>Thumbnail:</td> <td><input name="thumb" type="file" class="form"/></td> </tr> <tr> <td>Categorie:</td> <td> <select name="cat" class="form"> <?php { $catnaam = $result['naam']; echo "<option value=\"".$naam."\">".$catnaam."</option>"; } ?> </select> </td> </tr> <tr> <td colspan="2"><p align="center"><input name="upload" type="submit" class="form" value="Upload uw film!"/> </p></td> </tr> </table> </form> <?php if(isset($_POST['upload'])) { $film = $_FILES['film']['name']; $tmp_film = $_FILES['film']['tmp_name']; $thumb = $_FILES['thumb']['name']; $tmp_thumb = $_FILES['thumb']['tmp_name']; $cat = $_POST['cat']; $thumb_x = $thumb_afmeting[0]; $thumb_y = $thumb_afmeting[1]; //uploaden if($thumb_x > 200) { echo "De toegestane breedte voor een thumbnail is 200 pixels"; } elseif($thumb_y > 150) { echo "De toegestane hoogte voor een thumbnail is 150 pixels"; } else { } $film_url = $cat."/".$film; $thumb_url = $cat."/".$thumb; $insert = "INSERT INTO films (categorie, film, thumbnail) VALUES ('".$cat."', '".$film_url."', '".$thumb_url."')"; { echo "Het uploaden is succesvol afgerond"; } else { echo "Het uploaden is mislukt"; } } ?>
Maar hij werkt niet helemaal.. Hij wilt niet uploaden! ik krijg een foutmelding namleijk:
Warning: move_uploaded_file(upload//vid_thmb_06.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in c:\wamp\www\opdracht\admin\filetoevoegen.php on line 131
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:/wamp/tmp\php129.tmp' to 'upload//vid_thmb_06.jpg' in c:\wamp\www\opdracht\admin\filetoevoegen.php on line 131
Warning: move_uploaded_file(upload//vid_thmb_06.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in c:\wamp\www\opdracht\admin\filetoevoegen.php on line 143
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:/wamp/tmp\php129.tmp' to 'upload//vid_thmb_06.jpg' in c:\wamp\www\opdracht\admin\filetoevoegen.php on line 143
Het uploaden is succesvol afgerond
Iemand idee wat er fout is?
upload is :
../upload/hierdecategorienaamdiehijkiest/filmpje & thumbnail.
|