hi i have been looking the whole day on how i can do file upload all the tutorials i get are not working for some reason or to complicated to intergate with my form...
i want 2 upload fields one for images and the other one for any type of files (large files)
if you can help... it would be great im so tired of searching on google...
if you give me a starting step would be great also  im very new to php
here is were i want to have my upload form
Code:
<?php
include "inc/header.php";
if(isset($_POST['submit']))
{//begin of if($submit).
//global variables
$title_en = $_POST['title_en'];
$title_ar = $_POST['title_ar'];
$en = $_POST['en'];
$ar = $_POST['ar'];
$cat = $_POST['cat'];
//check if (title) field is empty then print error message.
if(!$title_en){ //this means If the title is really empty.
echo "Error: News title is a required field. Please fill it.";
exit(); //exit the script and don't do anything else.
}// end of ifdtime
//run the query which adds the data gathered from the form into the database
$result = mysql_query("INSERT INTO contents (title_en, title_ar, dtime, en, ar, cat)
VALUES ('$title_en','$title_ar',NOW(),'$en','$ar','$cat')",$connect);
//print success message.
echo "<b>Thank you! data added Successfully!";
echo "<meta http-equiv=Refresh content=2;url=index.php>";
}//end of if($submit).
// If the form has not been submitted, display it!
else
{//begin of else
?>
<h3>::Add News</h3>
<form method="post" action="<?php echo $_SERVER[PHP_SELF] ?>" enctype="multipart/form-data">
<table border="0" cellspacing="4" cellpadding="4">
<tr>
<td>Select Category:</td>
<td colspan="2"><select name="cat"><?php
$sql = 'SELECT DISTINCT `catname` from `categories`';
$result = @mysql_query($sql,$connect);
while ($row = @mysql_fetch_assoc($result)) {
echo '<option value="'.$row['id'].'">'.$row['catname'].'</option>';
} ?>
</td>
</tr>
<tr>
<td>Title:</td>
<td ><input name="title_en" size="40" maxlength="255"></td>
<td><input name="title_ar" size="40" maxlength="255"></td>
</tr>
<tr>
<td>Content:</td>
<td><textarea name="eng" rows="7" cols="30"></textarea></td>
<td><textarea name="ar" rows="7" cols="30"></textarea></td>
</tr>
<tr>
<td colspan="3" class="submit"><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
<?php
}//end of else
include "inc/footer.php";
?>
as for the view page i was thinking to have it in this way
echo file link only if a file have been uploaded
echo image only if an image have been uploaded
|