Index: /extensions/File_Uploader/admin/admin_upload.php
===================================================================
--- /extensions/File_Uploader/admin/admin_upload.php	(revision 19774)
+++ /extensions/File_Uploader/admin/admin_upload.php	(revision 19775)
@@ -37,5 +37,5 @@
 
 function file_uploader_upload_file($file_uploader_file) {
-	include('static.inc.php');
+	include_once(dirname(__FILE__).'/install/config_default.inc.php');
 	
 	global $conf;
@@ -69,11 +69,12 @@
 		if(!mkdir($file_uploader_file_directory_full))
 			$file_uploader_errors['upload_error'] = l10n('Unable to create folder ').$file_uploader_file_directory_full;
-	//If the physical category si not in database, we add it
-	if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file_category.'";')) == 0){
-		$next_id = pwg_db_nextval('id', CATEGORIES_TABLE);
-		$category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';'));
-		$category_rank = $category_rank['MAX(rank)'] + 1;
-		pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank) VALUES ('.$next_id.', "'.$file_uploader_file_category.'", "'.$file_uploader_file_category.'", '.$category_rank.', "'.$conf['newcat_default_status'].'", "'.boolean_to_string($conf['newcat_default_visible']).'", "'.$next_id.'", '.$category_rank.');');
-	}
+		//If the physical category si not in database, we add it
+		else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file_category.'";')) == 0){
+			$next_id = pwg_db_nextval('id', CATEGORIES_TABLE);
+			$category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';'));
+			$category_rank = $category_rank['MAX(rank)'] + 1;
+			$file_uploader_physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_galleries_folder.'";'));
+			pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank, site_id) VALUES ('.$next_id.', "'.$file_uploader_file_category.'", "'.$file_uploader_file_category.'", '.$category_rank.', "private", "'.boolean_to_string($conf['newcat_default_visible']).'", "'.$file_uploader_physical_category_id.'", '.$category_rank.', 1);');
+		}
 	
 	if ($file_uploader_file['error'] !== UPLOAD_ERR_OK) {
@@ -116,5 +117,5 @@
 
 function file_uploader_upload_thumbnail($file_uploader_thumbnail, $file_uploader_file_name_wo_extension, $file_uploader_file_extension, $file_uploader_file_folder) {
-	include('static.inc.php');
+	include_once(dirname(__FILE__).'/install/config_default.inc.php');
 	
 	$file_uploader_thumbnail_tmp = $file_uploader_thumbnail['tmp_name'];
@@ -175,4 +176,5 @@
 	//Database registration
 	$file_path = pwg_db_real_escape_string($file_uploader_file['destination']);
+	$physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file['folder'].'";'));
 	$insert = array(
 		'file' => substr(strrchr($file_path, '/'), 1),
@@ -183,4 +185,5 @@
 		'representative_ext' => $file_uploader_thumbnail['extension'],
 		'filesize' => $file_uploader_file['size'],
+		'storage_category_id' => $physical_category_id,
 		'md5sum' => md5_file($file_path),
 		'added_by' => $user['id'],
@@ -195,6 +198,4 @@
 		$image_id = pwg_db_insert_id(IMAGES_TABLE);
 	}
-
-	$physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file['folder'].'";'));
 	
 	if(isset($file_uploader_file_properties['category']) and count($file_uploader_file_properties['category']) > 0) {
Index: /extensions/File_Uploader/admin/admin_upload.tpl
===================================================================
--- /extensions/File_Uploader/admin/admin_upload.tpl	(revision 19774)
+++ /extensions/File_Uploader/admin/admin_upload.tpl	(revision 19775)
@@ -50,5 +50,5 @@
 					<span class="property">{'Album:'|@translate}</span>
 				</label>
-				<select style="width:400px" name="file_uploader[category]" id="file_uploader_album_select" size="1">
+				<select style="width:400px" name="file_uploader[category]" id="albumSelect" size="1">
 					{html_options options=$category_parent_options selected=$file_uploader.category}
 				</select>
Index: tensions/File_Uploader/admin/static.inc.php
===================================================================
--- /extensions/File_Uploader/admin/static.inc.php	(revision 19774)
+++ 	(revision )
@@ -1,32 +1,0 @@
-<?php
-	$file_uploader_galleries_dir = PHPWG_ROOT_PATH.'galleries/';
-	
-	$file_uploader_allowed_thumbnail_extension = array('jpg', 'jpeg', 'gif', 'png');
-	
-	$file_uploader_destination_folder = array(
-		'pdf' => 'pdf',
-		'doc' => 'documents',
-		'docx' => 'documents',
-		'odt' => 'documents',
-		'xls' => 'spreadsheets',
-		'xlsx' => 'spreadsheets',
-		'ods' => 'spreadsheets',
-		'ppt' => 'presentations',
-		'pptx' => 'presentations',
-		'odp' => 'presentations',
-		'webm' => 'videos',
-		'webmv' => 'videos',
-		'ogv' => 'videos',
-		'm4v' => 'videos',
-		'mp4' => 'videos',
-		'flv' => 'videos',
-		'mp3' => 'musics',
-		'ogg' => 'musics',
-		'oga' => 'musics',
-		'm4a' => 'musics',
-		'webma' => 'musics',
-		'fla' => 'musics',
-		'wav' => 'musics',
-		'others' => 'others',
-	);
-?>
Index: /extensions/File_Uploader/install/config_default.inc.php
===================================================================
--- /extensions/File_Uploader/install/config_default.inc.php	(revision 19774)
+++ /extensions/File_Uploader/install/config_default.inc.php	(revision 19775)
@@ -1,3 +1,34 @@
 <?php
+$file_uploader_galleries_folder = 'file_uploader';
+$file_uploader_galleries_dir = PHPWG_ROOT_PATH.'galleries/'.$file_uploader_galleries_folder.'/';
+
+$file_uploader_allowed_thumbnail_extension = array('jpg', 'jpeg', 'gif', 'png');
+	
+$file_uploader_destination_folder = array(
+	'pdf' => 'pdf',
+	'doc' => 'documents',
+	'docx' => 'documents',
+	'odt' => 'documents',
+	'xls' => 'spreadsheets',
+	'xlsx' => 'spreadsheets',
+	'ods' => 'spreadsheets',
+	'ppt' => 'presentations',
+	'pptx' => 'presentations',
+	'odp' => 'presentations',
+	'webm' => 'videos',
+	'webmv' => 'videos',
+	'ogv' => 'videos',
+	'm4v' => 'videos',
+	'mp4' => 'videos',
+	'flv' => 'videos',
+	'mp3' => 'musics',
+	'ogg' => 'musics',
+	'oga' => 'musics',
+	'm4a' => 'musics',
+	'webma' => 'musics',
+	'fla' => 'musics',
+	'wav' => 'musics',
+	'others' => 'others',
+);
 
 $config_default = array(
Index: /extensions/File_Uploader/install/functions.inc.php
===================================================================
--- /extensions/File_Uploader/install/functions.inc.php	(revision 19775)
+++ /extensions/File_Uploader/install/functions.inc.php	(revision 19775)
@@ -0,0 +1,15 @@
+<?php
+function file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir) {
+	//If the directory does not exist, we create it
+	if (!file_exists($file_uploader_galleries_dir))
+		if(!mkdir($file_uploader_galleries_dir))
+			array_push($page['errors'], l10n('Unable to create folder ').$file_uploader_galleries_dir);
+		//If the physical category si not in database, we add it
+		else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_galleries_folder.'";')) == 0){
+			$next_id = pwg_db_nextval('id', CATEGORIES_TABLE);
+			$category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';'));
+			$category_rank = $category_rank['MAX(rank)'] + 1;
+			pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank, site_id) VALUES ('.$next_id.', "'.$file_uploader_galleries_folder.'", "'.$file_uploader_file_category.'", '.$category_rank.', "private", "true", "'.$next_id.'", '.$category_rank.', 1);');
+		}
+}
+?>
Index: /extensions/File_Uploader/maintain.inc.php
===================================================================
--- /extensions/File_Uploader/maintain.inc.php	(revision 19774)
+++ /extensions/File_Uploader/maintain.inc.php	(revision 19775)
@@ -3,12 +3,18 @@
 
 function plugin_install() {
-	include(dirname(__FILE__).'/install/config_default.inc.php');
+	include_once(dirname(__FILE__).'/install/config_default.inc.php');
+	include_once(dirname(__FILE__).'/install/functions.inc.php');
 
 	$query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("file_uploader" ,"'.pwg_db_real_escape_string(serialize($config_default)).'", "File Uploader plugin parameters");';
 	pwg_query($query);
+	
+	file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir);
 }
 
 function plugin_activate() {
-
+	include_once(dirname(__FILE__).'/install/config_default.inc.php');
+	include_once(dirname(__FILE__).'/install/functions.inc.php');
+	
+	file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir);
 }
 
