Nieuw lid |
|
<?php
include "../inc/connect.php";
$alias=$_GET['alias'];
$Toevoegen = "INSERT INTO portfolio(titel, url, text, img) VALUES('" . $_POST['titel'] . "', '" . $_POST['url'] . "', '" . $_POST['text'] . "', '" . $_POST['file'] . "')";
$uToevoegen = mysql_query( $Toevoegen );
if( $uToevoegen )
{
if(isset($_POST['img'])) {
// If action is add.
if($_POST['img'] == 'add') {
// Define the folder where the file will be uploaded.
$upload_path = '../uploads/' . $_FILES['file']['name'];
// Check if the file already exists in the folder.
if(!file_exists($upload_path)) {
// Check the size of the file.
// The file should be under 100 kb. But OVER 0 bytes.
if($_FILES['file']['size'] < 1000000 && $_FILES['file']['size'] > 0) {
// If there are any errors.
if($_FILES['file']['error']) {
echo "Error: " . $_FILES['file']['error'];
} else {
// Success!
echo "File successfully uploaded.<br /><br />";
echo "The filename is: <strong>" . $_FILES['file']['name'] . "</strong><br />";
echo "The filesize is: <strong>" . $_FILES['file']['size'] . "</strong><br />";
echo "The filetype is: <strong>" . $_FILES['file']['type'] . "</strong><br />";
echo "The file is temporary saved in: <strong>" . $_FILES['file']['tmp_name'] . "</strong><br />";
echo "You will be return to the CMS automatecly";
// Move uploaded file to upload folder.
move_uploaded_file($_FILES['file']['tmp_name'], $upload_path);
}
} else {
echo $_FILES['file']['size'] < 1 ? 'Incorrect filename.' : 'File size is too big';
}
} else {
echo "File already exists in your folder. ";
}
}
}
}
else
{
echo 'Er is een fout! ' . mysql_error();
}
?>
<?php include "../inc/connect.php"; $alias=$_GET['alias']; $Toevoegen = "INSERT INTO portfolio(titel, url, text, img) VALUES('" . $_POST['titel'] . "', '" . $_POST['url'] . "', '" . $_POST['text'] . "', '" . $_POST['file'] . "')"; if( $uToevoegen ) { if(isset($_POST['img'])) { // If action is add. if($_POST['img'] == 'add') { // Define the folder where the file will be uploaded. $upload_path = '../uploads/' . $_FILES['file']['name']; // Check if the file already exists in the folder. // Check the size of the file. // The file should be under 100 kb. But OVER 0 bytes. if($_FILES['file']['size'] < 1000000 && $_FILES['file']['size'] > 0) { // If there are any errors. if($_FILES['file']['error']) { echo "Error: " . $_FILES['file']['error']; } else { // Success! echo "File successfully uploaded.<br /><br />"; echo "The filename is: <strong>" . $_FILES['file']['name'] . "</strong><br />"; echo "The filesize is: <strong>" . $_FILES['file']['size'] . "</strong><br />"; echo "The filetype is: <strong>" . $_FILES['file']['type'] . "</strong><br />"; echo "The file is temporary saved in: <strong>" . $_FILES['file']['tmp_name'] . "</strong><br />"; echo "You will be return to the CMS automatecly"; // Move uploaded file to upload folder. } } else { echo $_FILES['file']['size'] < 1 ? 'Incorrect filename.' : 'File size is too big'; } } else { echo "File already exists in your folder. "; } } } } else { } ?>
Zo heb ik het nu, maar dit werkt half: hij insert alles in de database , dit gaat helemaal goed, maar hij upload geen plaatjes:(. hoe en wat is mijn volgende stap?
XOXO
Matthias. |