fout met uploaden
Appie_Dijk - 18/08/2005 22:40 (laatste wijziging 19/08/2005 09:00)
Lid
Wat doe ik fout? :o
ik krijg de volgende foutmelding:
Warning: copy(foto.jpg): failed to open stream: No such file or directory in /home/www/toevoegen_machines.php on line 21
toevoegen_machines.php:
<?php
include("config.php");
if(isset($_POST['submit'])) {
$merk = $_POST['merk'];
$type = $_POST['type'];
$urenstand = $_POST['urenstand'];
$algemenestaat = $_POST['algemenestaat'];
$btw = $_POST['btw'];
$prijs = $_POST['prijs'];
$extrainfo1 = $_POST['extrainfo1'];
$extrainfo2 = $_POST['extrainfo2'];
$extrainfo3 = $_POST['extrainfo3'];
$extrainfo4 = $_POST['extrainfo4'];
$extrainfo5 = $_POST['extrainfo5'];
$omschrijving = $_POST['omschrijving'];
$foto = $_POST['foto'];
$map = "fotos/";
$bestand2 = explode("\\", $bestand_name);
$bestand2 = "$bestand2[$laatste]";
copy($foto, "$map$bestand2");
mysql_query("INSERT INTO machines (merk, type, bouwjaar, urenstand, algemenestaat, btw, prijs, extrainfo1, extrainfo2, extrainfo3, extrainfo4, extrainfo5, omschrijving, foto) VALUES ('". $merk ."', '". $type ."', '". $bouwjaar ."', '". $urenstand ."', '". $algemenestaat ."', '". $btw ."', '". $prijs ."', '". $extrainfo1 ."', '". $extrainfo2 ."', '". $extrainfo3 ."', '". $extrainfo4 ."', '". $extrainfo5 ."', '". $omschrijving ."', '<img border=\"0\" src=\"http://www.mijnsite.nl/fotos/". $foto ."\">')");
echo "". $merk ." ". $type ." is toegevoegd!<br>";
echo "<a href='admin.php'>Ga terug!</a><br>";
echo "<a href='toevoegen_machine.php'>Nog een machine toevoegen!</a><br>";
} else {
?>
<style type="text/css">
body, td {
font-family: tahoma;
font-size: 10pt;
}
</style>
<form action="" method="post">
<table width="600">
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Merk: <input name="merk" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Type: <input name="type" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" colspan="5" bgcolor="#BBE100"><b>Omschrijving:
<input name="omschrijving" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="225" rowspan="13" valign="top">Bestand: <input type=file name=foto></td>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Bouwjaar</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="bouwjaar" type="text" value="" maxlength="4"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Urenstand</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="urenstand" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Algemene staat</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="algemenestaat" type="text" value="" maxlength="50"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>BTW / Marge</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="btw" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Prijs excl.</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="prijs" type="text" value="" maxlength="10"></td></tr>
<tr>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Extra informatie</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo1" type="text" value="" maxlength="250"></td>
</tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo2" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo3" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo4" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo5" type="text" value="" maxlength="250"></td></tr>
<tr><td colspan="4"> </td></tr>
<tr><td colspan="4"><input type="submit" value="Voeg Toe!" name="submit"><input type="reset" value="Leeg Maken!"></td></tr>
</table>
</form>
<?
echo "<a href='admin.php'>Ga terug!</a><br>";
}
?>
<?php
include ( "config.php" ) ;
if ( isset ( $_POST [ 'submit' ] ) ) { $merk = $_POST [ 'merk' ] ;
$type = $_POST [ 'type' ] ;
$urenstand = $_POST [ 'urenstand' ] ;
$algemenestaat = $_POST [ 'algemenestaat' ] ;
$btw = $_POST [ 'btw' ] ;
$prijs = $_POST [ 'prijs' ] ;
$extrainfo1 = $_POST [ 'extrainfo1' ] ;
$extrainfo2 = $_POST [ 'extrainfo2' ] ;
$extrainfo3 = $_POST [ 'extrainfo3' ] ;
$extrainfo4 = $_POST [ 'extrainfo4' ] ;
$extrainfo5 = $_POST [ 'extrainfo5' ] ;
$omschrijving = $_POST [ 'omschrijving' ] ;
$foto = $_POST [ 'foto' ] ;
$map = "fotos/" ;
$bestand2 = explode ( "\\" , $bestand_name ); $bestand2 = "$bestand2 [ $laatste ] ";
copy($foto , " $map $bestand2 ");
mysql_query(" INSERT INTO machines ( merk, type, bouwjaar, urenstand, algemenestaat, btw, prijs, extrainfo1, extrainfo2, extrainfo3, extrainfo4, extrainfo5, omschrijving, foto) VALUES ( '". $merk ."' , '". $type ."' , '". $bouwjaar ."' , '". $urenstand ."' , '". $algemenestaat ."' , '". $btw ."' , '". $prijs ."' , '". $extrainfo1 ."' , '". $extrainfo2 ."' , '". $extrainfo3 ."' , '". $extrainfo4 ."' , '". $extrainfo5 ."' , '". $omschrijving ."' , '<img border=\"0\" src=\"http://www.mijnsite.nl/fotos/". $foto ."\">' ) ");
echo " ". $merk ." ". $type ." is toegevoegd!< br> ";
echo " < a href= 'admin.php' > Ga terug!</ a>< br> ";
echo " < a href= 'toevoegen_machine.php' > Nog een machine toevoegen!</ a>< br> ";
} else {
?>
<style type="text/css">
body, td {
font-family: tahoma;
font-size: 10pt;
}
</style>
<form action="" method="post">
<table width="600">
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Merk: <input name="merk" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Type: <input name="type" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" colspan="5" bgcolor="#BBE100"><b>Omschrijving:
<input name="omschrijving" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="225" rowspan="13" valign="top">Bestand: <input type=file name=foto></td>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Bouwjaar</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="bouwjaar" type="text" value="" maxlength="4"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Urenstand</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="urenstand" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Algemene staat</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="algemenestaat" type="text" value="" maxlength="50"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>BTW / Marge</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="btw" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Prijs excl.</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="prijs" type="text" value="" maxlength="10"></td></tr>
<tr>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Extra informatie</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo1" type="text" value="" maxlength="250"></td>
</tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo2" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo3" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo4" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo5" type="text" value="" maxlength="250"></td></tr>
<tr><td colspan="4"> </td></tr>
<tr><td colspan="4"><input type="submit" value="Voeg Toe!" name="submit"><input type="reset" value="Leeg Maken!"></td></tr>
</table>
</form>
<?
echo "<a href='admin.php'>Ga terug!</a><br>" ; }
?>
7 antwoorden
Gesponsorde links
DRUNK - 18/08/2005 22:46 (laatste wijziging 18/08/2005 22:48)
PHP gevorderde
Waarom post je AL die HTML? De foutmelding geeft iets over copy(), hier moet je dus gaan zoeken, is de file wel echt geupload? Hoe benader je die geuploade file?
Heb je de voorbeelden van PHP.net (http://www.php.net/manual/en/features.file-upload.php) al bestudeerd, de uitleg gelezen?
succes!
PS: code-tags maken het lezen iets gemakkelijker ;)
jarro - 18/08/2005 22:46
HTML interesse
$bestand2 = "$bestand2[$laatste]";
moet dit niet zijn:
$bestand2 = "$bestand2[laatste]"; ??
en mag dit wel
"$map$bestand2" moet dat niet "".$map."".$bestand2."" zijn?
of zeg ik égt iets heel doms?
:$
Appie_Dijk - 18/08/2005 23:05
Lid
@Drunk: wordt niet echt wijzer van die php-manual... ik snap niet wat er fout is :S (nu ben ik ook nog niet zo super vertrouwd met php)
@Jarro: maakt geen verschil of ik dat erneer zet of mijn code
TFOL - 18/08/2005 23:26
PHP beginner
zet dit je form tag: enctype="multipart/form-data"
en als je iets wil uploaden gebruik je dit:
<?php
$tmp_bestand = $_FILES['uploadveldnaam']['tmp_name'];
$bestand = $_FILES['uploadveldnaam']['name'];
$locatie = "Map waar foto is moet komen";
move_uploaded_file($tmp_bestand, $locatie."/".$bestand);
?>
<?php
$tmp_bestand = $_FILES [ 'uploadveldnaam' ] [ 'tmp_name' ] ;
$bestand = $_FILES [ 'uploadveldnaam' ] [ 'name' ] ;
$locatie = "Map waar foto is moet komen" ;
?>
Appie_Dijk - 19/08/2005 11:34 (laatste wijziging 19/08/2005 12:02)
Lid
@TFOL
je bedoelt zo??? -ik krijg nu geen foutmelding meer maar hij upload ook niets?-
<?php
include("config.php");
if(isset($_POST['submit'])) {
$merk = $_POST['merk'];
$type = $_POST['type'];
$urenstand = $_POST['urenstand'];
$algemenestaat = $_POST['algemenestaat'];
$btw = $_POST['btw'];
$prijs = $_POST['prijs'];
$extrainfo1 = $_POST['extrainfo1'];
$extrainfo2 = $_POST['extrainfo2'];
$extrainfo3 = $_POST['extrainfo3'];
$extrainfo4 = $_POST['extrainfo4'];
$extrainfo5 = $_POST['extrainfo5'];
$omschrijving = $_POST['omschrijving'];
$foto = $_POST['foto'];
$tmp_bestand = $_FILES['uploadveldnaam']['tmp_name'];
$bestand = $_FILES['uploadveldnaam']['name'];
$locatie = "fotos";
move_uploaded_file($tmp_bestand, $locatie."/".$bestand);
mysql_query("INSERT INTO machines (merk, type, bouwjaar, urenstand, algemenestaat, btw, prijs, extrainfo1, extrainfo2, extrainfo3, extrainfo4, extrainfo5, omschrijving, foto) VALUES ('". $merk ."', '". $type ."', '". $bouwjaar ."', '". $urenstand ."', '". $algemenestaat ."', '". $btw ."', '". $prijs ."', '". $extrainfo1 ."', '". $extrainfo2 ."', '". $extrainfo3 ."', '". $extrainfo4 ."', '". $extrainfo5 ."', '". $omschrijving ."', '<img border=\"0\" src=\"http://www.mijnsite.nl/fotos/". $foto ."\">')");
echo "". $merk ." ". $type ." is toegevoegd!<br>";
echo "<a href='admin.php'>Ga terug!</a><br>";
echo "<a href='toevoegen_machine.php'>Nog een machine toevoegen!</a><br>";
} else {
?>
<style type="text/css">
body, td {
font-family: tahoma;
font-size: 10pt;
}
</style>
<form action="" method="post" enctype="multipart/form-data">
<table width="600">
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Merk: <input name="merk" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Type: <input name="type" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" colspan="5" bgcolor="#BBE100"><b>Omschrijving:
<input name="omschrijving" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="225" rowspan="13" valign="top">Bestand: <input type=file name=foto></td>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Bouwjaar</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="bouwjaar" type="text" value="" maxlength="4"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Urenstand</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="urenstand" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Algemene staat</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="algemenestaat" type="text" value="" maxlength="50"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>BTW / Marge</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="btw" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Prijs excl.</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="prijs" type="text" value="" maxlength="10"></td></tr>
<tr>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Extra informatie</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo1" type="text" value="" maxlength="250"></td>
</tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo2" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo3" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo4" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo5" type="text" value="" maxlength="250"></td></tr>
<tr><td colspan="4"> </td></tr>
<tr><td colspan="4"><input type="submit" value="Voeg Toe!" name="submit"><input type="reset" value="Leeg Maken!"></td></tr>
</table>
</form>
<?
echo "<a href='admin.php'>Ga terug!</a><br>";
}
?>
<?php
include ( "config.php" ) ;
if ( isset ( $_POST [ 'submit' ] ) ) { $merk = $_POST [ 'merk' ] ;
$type = $_POST [ 'type' ] ;
$urenstand = $_POST [ 'urenstand' ] ;
$algemenestaat = $_POST [ 'algemenestaat' ] ;
$btw = $_POST [ 'btw' ] ;
$prijs = $_POST [ 'prijs' ] ;
$extrainfo1 = $_POST [ 'extrainfo1' ] ;
$extrainfo2 = $_POST [ 'extrainfo2' ] ;
$extrainfo3 = $_POST [ 'extrainfo3' ] ;
$extrainfo4 = $_POST [ 'extrainfo4' ] ;
$extrainfo5 = $_POST [ 'extrainfo5' ] ;
$omschrijving = $_POST [ 'omschrijving' ] ;
$foto = $_POST [ 'foto' ] ;
$tmp_bestand = $_FILES [ 'uploadveldnaam' ] [ 'tmp_name' ] ;
$bestand = $_FILES [ 'uploadveldnaam' ] [ 'name' ] ;
$locatie = "fotos" ;
mysql_query ( "INSERT INTO machines (merk, type, bouwjaar, urenstand, algemenestaat, btw, prijs, extrainfo1, extrainfo2, extrainfo3, extrainfo4, extrainfo5, omschrijving, foto) VALUES ('" . $merk . "', '" . $type . "', '" . $bouwjaar . "', '" . $urenstand . "', '" . $algemenestaat . "', '" . $btw . "', '" . $prijs . "', '" . $extrainfo1 . "', '" . $extrainfo2 . "', '" . $extrainfo3 . "', '" . $extrainfo4 . "', '" . $extrainfo5 . "', '" . $omschrijving . "', '<img border=\" 0\" src=\" http://www.mijnsite.nl/fotos/" . $foto . "\" >')" ) ;
echo "" . $merk . " " . $type . " is toegevoegd!<br>" ; echo "<a href='admin.php'>Ga terug!</a><br>" ; echo "<a href='toevoegen_machine.php'>Nog een machine toevoegen!</a><br>" ;
} else {
?>
<style type="text/css">
body, td {
font-family: tahoma;
font-size: 10pt;
}
</style>
<form action="" method="post" enctype="multipart/form-data">
<table width="600">
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Merk: <input name="merk" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" bgcolor="#BBE100" colspan="5"><b>Type: <input name="type" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="600" colspan="5" bgcolor="#BBE100"><b>Omschrijving:
<input name="omschrijving" type="text" value="" maxlength="250"></b></td></tr>
<tr><td width="225" rowspan="13" valign="top">Bestand: <input type=file name=foto></td>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Bouwjaar</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="bouwjaar" type="text" value="" maxlength="4"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Urenstand</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="urenstand" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Algemene staat</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="algemenestaat" type="text" value="" maxlength="50"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>BTW / Marge</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="btw" type="text" value="" maxlength="10"></td></tr>
<tr><td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Prijs excl.</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="prijs" type="text" value="" maxlength="10"></td></tr>
<tr>
<td width="10"> </td>
<td width="155" bgcolor="#BBE100" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100">
<b>Extra informatie</b></td>
<td width="10" align="center"><b>:</b></td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo1" type="text" value="" maxlength="250"></td>
</tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo2" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo3" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo4" type="text" value="" maxlength="250"></td></tr>
<tr><td width="10"> </td>
<td width="155"> </td>
<td width="10" align="center"> </td>
<td width="200" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #BBE100"><input name="extrainfo5" type="text" value="" maxlength="250"></td></tr>
<tr><td colspan="4"> </td></tr>
<tr><td colspan="4"><input type="submit" value="Voeg Toe!" name="submit"><input type="reset" value="Leeg Maken!"></td></tr>
</table>
</form>
<?
echo "<a href='admin.php'>Ga terug!</a><br>" ; }
?>
TFOL - 19/08/2005 14:00
PHP beginner
- Als je iets wil uploaden gebruik je dit als input-tag gebruiken:
<input type="file" name="bestand" />
- Dit gebruik je om het te verwerken:
<?php
$tmp_bestand = $_FILES['bestand']['tmp_name'];
$bestand = $_FILES['bestand']['name'];
$locatie = "fotos";
move_uploaded_file($tmp_bestand, $locatie."/".$bestand);
?>
<?php
$tmp_bestand = $_FILES [ 'bestand' ] [ 'tmp_name' ] ;
$bestand = $_FILES [ 'bestand' ] [ 'name' ] ;
$locatie = "fotos" ;
?>
Gesponsorde links
Dit onderwerp is gesloten .