invision
01-29-2008, 05:15 AM
Hi,
I have a very basic script that moves an image into the 'images' folder and inserts data into a table.
Here's a small portion of it:if (isset($_POST['submitted2'])) {
$title = strip_tags(stripslashes($_POST['title']));
$htmltitle = $_POST['htmltitle'];
$user_id = $_SESSION[user_id];
if (is_uploaded_file ($_FILES['thumb']['tmp_name'])) {
if (move_uploaded_file($_FILES['thumb']['tmp_name'], "../images/{$_FILES['thumb']['name']}")) { // Moves the files over, for security.
$MIMEtype = $_FILES['thumb']['type'];
echo '';
} else { // If the file couldn't be moved over.
echo '';
$t = FALSE;
}
$t = $_FILES['thumb']['name'];
} else {
$t = FALSE;
}
$query = "INSERT INTO infobox(title,text,img,approved,visible) VALUES('$title','$htmltitle','$t','N','N')";
echo $t;
echo $query;
if ($result = mysql_query($query)) { // Everything Worked.
echo '<hr />';
echo '<p><b>New Info Box Added !</b></p><br />';
echo '<p>The Info Box has been added to the system.<br /><br />To approve this, please return to <a href="update_box.php">Info Box</a> section.</p>';
include ('../include/afootit.html');
exit;
}
}
Now when I echo the query, the only part missing is the thumbnail link, it completely skips the thumbnail url going into my table :(
What am I doing wrong? Any help would be fantastic!
I have a very basic script that moves an image into the 'images' folder and inserts data into a table.
Here's a small portion of it:if (isset($_POST['submitted2'])) {
$title = strip_tags(stripslashes($_POST['title']));
$htmltitle = $_POST['htmltitle'];
$user_id = $_SESSION[user_id];
if (is_uploaded_file ($_FILES['thumb']['tmp_name'])) {
if (move_uploaded_file($_FILES['thumb']['tmp_name'], "../images/{$_FILES['thumb']['name']}")) { // Moves the files over, for security.
$MIMEtype = $_FILES['thumb']['type'];
echo '';
} else { // If the file couldn't be moved over.
echo '';
$t = FALSE;
}
$t = $_FILES['thumb']['name'];
} else {
$t = FALSE;
}
$query = "INSERT INTO infobox(title,text,img,approved,visible) VALUES('$title','$htmltitle','$t','N','N')";
echo $t;
echo $query;
if ($result = mysql_query($query)) { // Everything Worked.
echo '<hr />';
echo '<p><b>New Info Box Added !</b></p><br />';
echo '<p>The Info Box has been added to the system.<br /><br />To approve this, please return to <a href="update_box.php">Info Box</a> section.</p>';
include ('../include/afootit.html');
exit;
}
}
Now when I echo the query, the only part missing is the thumbnail link, it completely skips the thumbnail url going into my table :(
What am I doing wrong? Any help would be fantastic!