I need help, I want to create a form that can upload two images, one for thumbnail and one for the main image. They should both be saved in different folders but in one database table. Thank you here is what I have done but the problem is 1. The images don't save in the database
<?php
require_once('includes/rypecms.php');
error_reporting(0);
if($_POST['submit'])
{
$lname=basename($_FILES['file_upload']['name']);
$ltname=$_FILES['file_upload']['tmp_name'];
$tname=basename($_FILES['file_upload']['tname']);
$ttname=$_FILES['file_upload']['tmp_name'];
$imagename = $_POST['imagename'];
$content = $_POST['content'];
$links = $_POST['links'];
$dir='image';
$dir2='thumb';
if(move_uploaded_file($ltname,$dir."/".$lname)){
if(move_uploaded_file($ttname,$dir2."/".$tname)){
{
mysql_select_db($database_rypecms, $rypecms);
$qur="INSERT INTO portweb (id, name, tname, imagename, content, links, pathl, patht) VALUES(' ', '$lname', '$tname', '$imagename', '$content', '$links', 'image/$lname' , 'thumb/$tname' )";
$res=mysql_query($qur , $rypecms);
echo 'files upload success';
}
}
}
}
?>
here is the form. two file upload buttons.one for thumbnail and the other for the main image
<html>
<head>
<title>upload pictures portfolio web</title>
</head>
<body>
<a href="portweb.php">Back</a>
<br />
<form action="addportweb.php" method="post" enctype="multipart/form-data">
<label>Main image:</label><input type="file" name="file_upload" /><br />
<label>Thumbnail:</label><input type="file" name="file_upload" /><br />
<label>Name:</label> <input type="text" name="imagename" class="text_input" maxlength="100" /><br />
<label>Description:</label>
<textarea name="content" style="width: 300px; height:80px; padding: 5px; resize:none;" ></textarea>
<br />
<label>Link:</label> <textarea name="links" style="width: 100px; height:50px; padding: 5px; resize:none;" ></textarea><br />
<input type="submit" name="submit" value="upload" />
</form>
</body>
</html>