Uploading files to the server with a description

Hello everyone. I recently started doing layout and now I’ve made the 1st normal layout. Now one thing interests, it is necessary to make normal forms. So guys, I have a form for uploading images to the server with a description that you can enter, or you can not enter. What am I asking? Please help with PHP code that will do all this. I.e. What do I have.
Form.

<form action="loadfile.php" enctype="multipart/form-data" method="post">
<input id="load" name="load" type="file" size="59">
<input id="descrip" name="descrip" type="text" size="70.9">
<input type="submit" value="">
</form>

And the PHP script loadfile.php, which simply uploads the image to the server without a description.

<?
if (empty($_FILES['img']['tmp_name'])) die('   ');
$tmp = $_FILES['img']['tmp_name'];
$fname = $_FILES['img']['name'];
if (!move_uploaded_file($tmp, 'file/image/'.$fname)) die('      ');
echo '<img src="/file/image/'.$fname.'" />'; //  
?>

From the script I want it to upload the image to the server and display what I need with the description that was entered when the file was uploaded.
I’m practically 0 in PHP so… Help…


Answer 1, authority 100%

First, you need to save the description.
There are several ways:
1.Drive into database
2.Create a file and put a description there
Otherwise, the description will only show when the image is uploaded.

<?
    $des = $_POST['descrip'];
    if (empty($_FILES['img']['tmp_name'])) die('   ');
    $tmp = $_FILES['img']['tmp_name'];
    $fname = $_FILES['img']['name'];
    if (!move_uploaded_file($tmp, 'file/image/'.$fname)) die('      ');
    echo '<img src="/file/image/'.$fname.'" /><br />'.$des; //  
    $fp = fopen ($fname.".txt", "w"); 
    fwrite($fp,$des);
    fclose($fp); 
    ?>

This is what we covered “Writing a description to a file”. If it is necessary through sql that write.
And the output is elementary through an include with the name of the picture and at the end *.txt, example

include($fname.".txt");