Location: PHPKode > scripts > Advanced file upload and ajax upload > advanced-file-upload-and-ajax-upload/mysql_multi_upload/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    

// multi filename information 
/* for ($i = 0; $i < count($Uploader->uploaded_files); $i++) {
 echo '<br>'.$Uploader->uploaded_files[$i];
} */
     
echo '</div>';
	
for ($i = 0; $i < count($Uploader->uploaded_files); $i++) {
    $picture =$Uploader->uploaded_files[$i];

    if ( $Uploader->uploaded) {
        $sql = "INSERT INTO `gallery` (`id`,`picture`) VALUES ( NULL,'$picture'); ";
        mysql_query($sql);
        echo "<br>successful";
    } else {
        $Uploader->result_report();
} } }
?>
<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">
      </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 = 5;
                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>
            </table>
			<input class="submit" type="submit" name="submit" value="save" >
</form>
</body></html>
Return current item: Advanced file upload and ajax upload