Nieuw lid |
|
de --> had ik even gedaan om mijn topick in te korten.
Ik zal even op php.net gaan neuzen.
Ik heb ook nog op w3.com gekeken
onderstaand heb ik het script wat ik gebruik, maar kan er niks aan ondekken.
<?php
include("connect.php");
if(!empty($_POST)){
$naam = $_POST["naam"];
$code = $_POST["code"];
$prijs = $_POST["prijs"];
$omschrijving = addslashes($_POST["omschrijving"]);
$type = $_POST["type"];
$query = "INSERT INTO artikel VALUES ('','" .$naam. "','". $code. "','". $prijs. "','". $omschrijving. "','','". $type. "');";
$result = mysql_query($query) or die(mysql_error());
}
$ThisFileName = basename(__FILE__); // get the file name
$path = str_replace("/cms/scripts/".$ThisFileName,"",__FILE__); // get the directory path
$upload_dir = $path. "/images/"; // be shure php has access to this dir (chmod)
$new_file = $upload_dir."/".$_FILES['userfile']['name'];
if ($_POST['upload'] == "Upload") {
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
move_uploaded_file($_FILES['userfile']['tmp_name'], $new_file) or
print "could not store $new_file ";
chmod ($upload_dir. $_FILES['userfile']['name'], 0777);
$query = "UPDATE artikel SET foto = '". $_FILES['userfile']['name']. "' WHERE naam = '". $naam. "' AND code = '". $code. "';";
$result = mysql_query($query) or die(mysql_error());
header("location: ../index.php");
} else {
switch ($_FILES['userfile']['error']) {
case 0:
print "<a href='#' onClick='history.back()'>Terug</a><br>!is_uploaded_file.., no file upload?<br><a href='../index.php'> Gewoon verder gaan!</a> ";
break;
case 1:
print "<a href='#' onClick='history.back()'>Terug</a><br>De file dat u probeerd te uploaden is te groot. bewerk het bestand en probeer het opnieuw (max 50 mb); size limit set by php.ini<br><a href='../index.php'> Gewoon verder gaan!</a> ";
break;
}
}
}
?>
<?php include("connect.php"); $naam = $_POST["naam"]; $code = $_POST["code"]; $prijs = $_POST["prijs"]; $omschrijving = addslashes($_POST["omschrijving"]); $type = $_POST["type"]; $query = "INSERT INTO artikel VALUES ('','" .$naam. "','". $code. "','". $prijs. "','". $omschrijving. "','','". $type. "');"; } $ThisFileName = basename(__FILE__); // get the file name $path = str_replace("/cms/scripts/".$ThisFileName,"",__FILE__); // get the directory path $upload_dir = $path. "/images/"; // be shure php has access to this dir (chmod) $new_file = $upload_dir."/".$_FILES['userfile']['name']; if ($_POST['upload'] == "Upload") { print "could not store $new_file "; chmod ($upload_dir. $_FILES['userfile']['name'], 0777); $query = "UPDATE artikel SET foto = '". $_FILES['userfile']['name']. "' WHERE naam = '". $naam. "' AND code = '". $code. "';"; header("location: ../index.php"); } else { switch ($_FILES['userfile']['error']) { case 0: print "<a href='#' onClick='history.back()'>Terug</a><br>!is_uploaded_file.., no file upload?<br><a href='../index.php'> Gewoon verder gaan!</a> "; break; case 1: print "<a href='#' onClick='history.back()'>Terug</a><br>De file dat u probeerd te uploaden is te groot. bewerk het bestand en probeer het opnieuw (max 50 mb); size limit set by php.ini<br><a href='../index.php'> Gewoon verder gaan!</a> "; break; } } } ?>
Citaat: Rensjuh edit:
[..code..]tags gebruiken![/code] |