Hi,
Ik ben bezig met een script waarmee ik producten kan toevoegen. Maar ik krijg een vervelende error. Hoe los ik dit op?
Er is een fout opgetreden
move_uploaded_file(img/producten/dsdssdww.png) [function.move-uploaded-file]: failed to open stream: No such file or directory
Foutcode #2
Bestand /home/segouir45/domains/segouir45.fortyfive.versio.nl/public_html/shop/admin/producten.php
Lijn 102
Er is een fout opgetreden
move_uploaded_file() [function.move-uploaded-file]: Unable to move /tmp/phpDR2pYi to img/producten/dsdssdww.png
Foutcode #2
Bestand /home/segouir45/domains/segouir45.fortyfive.versio.nl/public_html/shop/admin/producten.php
Lijn 102
Code
Ik ben bezig met een script waarmee ik producten kan toevoegen. Maar ik krijg een vervelende error. Hoe los ik dit op?
Er is een fout opgetreden
move_uploaded_file(img/producten/dsdssdww.png) [function.move-uploaded-file]: failed to open stream: No such file or directory
Foutcode #2
Bestand /home/segouir45/domains/segouir45.fortyfive.versio.nl/public_html/shop/admin/producten.php
Lijn 102
Er is een fout opgetreden
move_uploaded_file() [function.move-uploaded-file]: Unable to move /tmp/phpDR2pYi to img/producten/dsdssdww.png
Foutcode #2
Bestand /home/segouir45/domains/segouir45.fortyfive.versio.nl/public_html/shop/admin/producten.php
Lijn 102
Code
$showform = TRUE;
if(isset($_POST[voeg]))
{
if(trim($_POST[naam]) === )
$fout->nieuw(U heeft nog geen naam ingevuld.);
if(trim($_POST[prijs]) === )
$fout->nieuw(U heeft nog geen prijs ingevuld.);
if(trim($_POST[beschrijving]) === )
$fout->nieuw(U heeft nog geen omschrijving ingevuld.);
else
{
if(strlen($_POST[beschrijving]) < 5)
$fout->nieuw(Uw omschrijving is te kort. Minimaal 5 tekens.);
}
$map = img/producten/;
$ext = array (image/jpeg, image/pjpeg, image/png, image/x-png, image/gif); //MIME types welke zijn toegestaan
$toext = array(.jpg, .jpeg, .gif, .png);
$maxgrote = 500000;// = 100 kb [in bytes]
$avatar = $_FILES[avatar];
if($_FILES[avatar][size] >= 1)
{
$avatar = $_FILES[avatar];
switch($avatar[error])
{
case UPLOAD_ERR_OK;
$pixels = getimagesize($_FILES[avatar][tmp_name]);
if($avatar[size] > $maxgrote)
$fout->nieuw(Uw avatar mag niet groter zijn dan . $maxgrote . bytes.);
break;
case UPLOAD_ERR_INI_SIZE:
$fout->nieuw(Het maximale upload limiet van de server is overschreden.);
break;
case UPLOAD_ERR_PARTIAL:
$fout->nieuw(Er is een fout opgetreden tijdens het uploaden.);
break;
default:
$fout->nieuw(Er is een onbekende fout opgetreden.);
break;
}
if(!in_array($avatar[type], $ext) OR !in_array(strtolower(strrchr($avatar[name], .)),$toext))
$fout->nieuw(Uw afbeeldig heeft een verkeerde bestandsextentie.);
}
if($fout->totaal() == 0)
{
if($_FILES[avatar][size] >= 1)
{
$extentie = strtolower(strrchr($avatar[name], .));
$nieuw = $map . $avatar[name];
move_uploaded_file($_FILES[avatar][tmp_name], $map.$_POST[naam].$extentie);
}
$mysql->query("INSERT INTO
producten
(
naam,
omschrijving,
seo,
categorie_id,
sub_id,
prijs,
afbeelding
)
VALUES
(
".$mysql->escape($_POST[naam]).",
".$mysql->escape($_POST[beschrijving]).",
".$core->seo($mysql->escape($_POST[naam])).",
".$mysql->escape($_POST[categorie]).",
".$mysql->escape($_POST[subcats]).",
".$mysql->escape($_POST[prijs]).",
".$map.$core->seo($_POST[naam]).$extentie."
)");
echo <div class="goede">U heeft succesvol een nieuwe subcategorie toegevoegd.</div>;
$showform = FALSE;
}
}
if($showform === TRUE)
{
if($fout->totaal() >= 1)
echo $fout->weergeef();
?>
<form method="post" enctype="multipart/form-data">
<strong>Product aanmaken</strong><br />
<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
<table>
<tr>
<td width="150"><span class="verplicht">*</span> Naam:</td>
<td><input type="text" name="naam" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]) :[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>" /></td>
</tr>
<tr>
<td width="150"><span class="verplicht">*</span> Prijs:</td>
<td><input type="text" name="prijs" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]prijs[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]prijs[/COLOR][COLOR= #007700]]) :[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>" /></td>
</tr>
<tr>
<td><span class="verplicht">*</span> Categorie:</td>
<td><select name="categorie" class="select">
<option value="0">Geen categorie</option>
[COLOR= #0000BB]<?php
$categorieQuery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT
id,
naam,
seo
FROM
categorie
WHERE
verwijderd = 0
ORDER BY
naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]num_rows[COLOR= #007700]([/COLOR][COLOR= #0000BB]$categorieQuery[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$categorieFetch[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$categorieQuery[/COLOR][COLOR= #007700]))
{[/COLOR]
?>
<option value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$categorieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]);[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$categorieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR] ?></option>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}
}[/COLOR]
?>
</select></td>
</tr>
<tr>
<td><span class="verplicht">*</span> Sub categorie:</td>
<td><select name="subcats" class="select">
<option value="0">Geen categorie</option>
[COLOR= #0000BB]<?php
$subcategorieQuery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT
id,
naam,
seo
FROM
sub_categorie
WHERE
verwijderd = 0
ORDER BY
naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]num_rows[COLOR= #007700]([/COLOR][COLOR= #0000BB]$subcategorieQuery[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$subcategorieFetch[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$subcategorieQuery[/COLOR][COLOR= #007700]))
{[/COLOR]
?>
<option value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$subcategorieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]);[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$subcategorieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR] ?></option>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}
}[/COLOR]
?>
</select></td>
</tr>
<tr>
<td>Omschrijving</td>
<td>
<textarea name="beschrijving" cols="30" rows="10">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]entities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]]) :[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?></textarea>
</td>
</tr>
<tr>
<td width="150"><span class="verplicht">*</span> Afbeelding:</td>
<td><input type="file" name="avatar" id="avatar" /></td>
</tr>
</table><br />
</div>
<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
<table>
<tr>
<td></td>
<td><input type="submit" name="voeg" value="Verder" /></td>
</tr>
</table>
</div>
</form> 


