Location: PHPKode > scripts > Advanced file upload and ajax upload > advanced-file-upload-and-ajax-upload/mysql/file_add.php
<?php 
	$hostname_config = "localhost";
  $username_config = "root";
 $password_config = "";
 $database_config = "stnc_file_upload";

$config = mysql_connect($hostname_config, $username_config, $password_config) or trigger_error(mysql_error(), E_USER_ERROR);

if (!@mysql_connect($hostname_config, $username_config, $password_config)) die ('error'.mysql_error());
if (!@mysql_select_db($database_config)) die (mysql_error());

 function thumb_path($filename,$eklenecek_taki,$hedef_yol) {
$dosya_bilgi = pathinfo($filename);
$dosya_isim=$dosya_bilgi['filename']; 
$uzanti='.'.$dosya_bilgi['extension'];
return $son_ekli_isim=$hedef_yol.'/thumb/'.$dosya_isim.'_thumb'.$uzanti;
}
require_once ('../stnc_upload_class_v4.php');
if ($_FILES) { 
echo '<div id="reports">';   
$extension_types = array('jpg', 'gif','png');
$Uploader = & new stnc_file_upload();
$Uploader->language = '../stnc_upload_class_lang/english.php';
$Uploader->picture_uploads (true, 'MB', '1');
$Uploader->file_upload( 'MB', '3');
$Uploader->  name_format (false,'ReportFile','st_','_nc');
$Uploader->uploader_set($_FILES['file'], 'uploads', $extension_types,true);   
 $Uploader -> result_report(); // report
 if ($Uploader->uploaded) //upload info // true or false    
 echo '<br>successful';
 $comment= $_POST['comment'] ;
		$RE1 = $Uploader->uploaded_files[0];//her resim degeri i├žin buras&#305; art&#305;r&#305;lablir.
 $sql = "INSERT INTO `gallery` (`id`,`comment`,`picture_1`) VALUES ( NULL,'$comment','$RE1'); ";
 $result = mysql_query ($sql); 
        // multi filename information 
      /* for ($i = 0; $i < count($Uploader->uploaded_files); $i++) {
            echo '<br>'.$Uploader->uploaded_files[$i];
        }
    */
        
        echo '</div>';
		

		

    }
    
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=1254">
        <meta name="Author" content="Stnc Web Hizmetleri-hide@address.com Tunc">        
        <link rel="stylesheet" type="text/css" href="css/style.css">
     
      </head>


       <form method="post" id="file_upload_form" action="" enctype="multipart/form-data" content="text/html; charset=utf-8">
            <table width="419" height="29" border="0">
                <tr>
                    <th colspan="2" scope="col" class="table_baslik">
                        pictrue  add
                      
                    </th>
                </tr>
                <?php 
              
                $max_no_img = 1;
                
                for ($res = 1; $res <= $max_no_img; $res++) { 
                    
                ?>
                <tr >
                    <td width="92">
                     picture
                    </td>
                    <td width="447">
                        <input type="file" id="picture_<?php echo $res?>" size="%50" name="file[]" />
                    </td>
                    <?php } ?>
                </tr>
           
            <tr >
                <td width="131">
                    <strong>picture comment</strong>
                </td>
                <td width="278" >
                    <input name="comment" type="text" size="45"  >
                </td>
            </tr>

            </table>

			<input class="submit" type="submit" name="submit" value="save" >

        </form>
Return current item: Advanced file upload and ajax upload