diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
index 35c2cceb0dc422213c54c43a74e6620008b7f63c..62904ee77d04e5568ca7b50807cf23946de8104f 100644
--- a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
+++ b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
@@ -87,7 +87,7 @@ HTMLArea.TYPO3Image = Ext.extend(HTMLArea.Plugin, {
 			this.getButton(buttonId).tooltip.title,
 			this.getWindowDimensions(
 				{
-					width:	610,
+					width:	650,
 					height:	500
 				},
 				buttonId
diff --git a/typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php b/typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
index 296fc5b18e9261de6a58b21a51b10278a4680c4a..d3a8650b7cdb1d373b433459507142f8784a3195 100644
--- a/typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
+++ b/typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
@@ -183,6 +183,9 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 	function init()	{
 		$this->initVariables();
 		$this->initConfiguration();
+			// init fileProcessor
+		$this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+		$this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
 			// Creating backend template object:
 		$this->doc = t3lib_div::makeInstance('template');
 		$this->doc->backPath = $GLOBALS['BACK_PATH'];
@@ -213,6 +216,8 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 		}
 			// Setting intial values for link attributes
 		$this->initLinkAttributes();
+			// Apply the same styles as those of the base script
+		$this->doc->bodyTagId = 'typo3-browse-links-php';
 			// Add attributes to body tag. Note: getBodyTagAdditions will invoke the hooks
 		$this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
 			// Adding RTE JS code
@@ -697,38 +702,37 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 						$this->expandFolder = $cmpPath;
 					}
 				}
+					// Get the selected folder
 				if ($this->expandFolder) {
 					$selectedFolder = FALSE;
-
 					$fileOrFolderObject = t3lib_file_Factory::getInstance()->retrieveFileOrFolderObject($this->expandFolder);
-						// it's a file
 					if ($fileOrFolderObject instanceof t3lib_file_Folder) {
+						// it's a folder
 						$selectedFolder = $fileOrFolderObject;
-
 					} elseif ($fileOrFolderObject instanceof t3lib_file_FileInterface) {
+						// it's a file
 						// @todo: find the parent folder, right now done a bit ugly, because the file does not
 						// support finding the parent folder of a file on purpose
 						$folderIdentifier = dirname($fileOrFolderObject->getIdentifier());
 						$selectedFolder = $fileOrFolderObject->getStorage()->getFolder($folderIdentifier);
 					}
 				}
-					// Add upload form if allowed
+					// If no folder is selected, get the user's default upload folder
 				if (!$selectedFolder) {
-					$fileStorages = $GLOBALS['BE_USER']->getFileStorages();
-					$fileStorage = reset($fileStorages);
-					$selectedFolder = $fileStorage->getRootLevelFolder();
+					$selectedFolder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
 				}
-				if ($selectedFolder) {
+					// Build the file upload and folder creation forms
+				$uploadForm = '';
+				$createFolder = '';
+				if ($selectedFolder && !$this->isReadOnlyFolder($selectedFolder)) {
 					$uploadForm = ($this->act === 'file') ? $this->uploadForm($selectedFolder) : '';
-					$createFolder = $this->createFolder($selectedFolder);
-				} else {
-					$uploadForm = $createFolder = '';
+					if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
+						$createFolder = $this->createFolder($selectedFolder);
+					}
 				}
+					// Insert the upload form on top, if so configured
 				if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
 					$content .= $uploadForm;
-					if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-						$content .= $createFolder;
-					}
 				}
 					// Render the filelist if there is a folder selected
 				if ($selectedFolder) {
@@ -737,7 +741,6 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 						$this->P['params']['allowedExtensions']
 					);
 				}
-
 				$content .= '
 
 			<!--
@@ -751,13 +754,13 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 					</table>
 					';
 
-					// Adding create folder + upload forms if applicable:
+					// Adding create folder + upload form if applicable
 				if (!$GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
 					$content .= $uploadForm;
-					if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-						$content .= $createFolder;
-					}
 				}
+				$content .= '<br />';
+				$content .= $createFolder;
+				$content .= '<br />';
 			break;
 			case 'spec':
 				if (is_array($this->thisConfig['userLinks.']))	{
@@ -867,7 +870,12 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 		return $content;
 	}
 
-	function addAttributesForm() {
+	/**
+	 * Creates a form for link attributes
+	 *
+	 * @return string The HTML code of the form
+	 */
+	public function addAttributesForm() {
 		$ltargetForm = '';
 		$additionalAttributeFields = '';
 			// Add page id, target, class selector box, title and parameters fields:
@@ -878,7 +886,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 		$ltitle = $this->addTitleSelector();
 		$rel = $this->addRelField();
 
-			// additional fields for page links
+			// additional fields for links
 		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['addAttributeFields']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['addAttributeFields'])) {
 			$_params = array(
 				'conf' => &$conf
diff --git a/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php b/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
index ec8d6a0974b30a9580d4aa01707ab0685d8394d8..aad0748286496c68df4e36e40f0e8a9b01c20741 100644
--- a/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
+++ b/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
@@ -143,6 +143,8 @@ class tx_rtehtmlarea_select_image extends browse_links {
 
 			// Creating backend template object:
 		$this->doc = t3lib_div::makeInstance('template');
+			// Apply the same styles as those of the base script
+		$this->doc->bodyTagId = 'typo3-browse-links-php';
 		$this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
 		$this->doc->backPath = $GLOBALS['BACK_PATH'];
 
@@ -808,21 +810,38 @@ class tx_rtehtmlarea_select_image extends browse_links {
 						$this->expandFolder = $cmpPath;
 					}
 				}
-
+					// Get the selected folder
 				if ($this->expandFolder) {
-					try {
-						$selectedFolder = t3lib_file_Factory::getInstance()->getFolderObjectFromCombinedIdentifier(
-							$this->expandFolder
-						);
-					} catch (Exception $e) {
-						$selectedFolder = FALSE;
+					$selectedFolder = FALSE;
+					$fileOrFolderObject = t3lib_file_Factory::getInstance()->retrieveFileOrFolderObject($this->expandFolder);
+					if ($fileOrFolderObject instanceof t3lib_file_Folder) {
+						// it's a folder
+						$selectedFolder = $fileOrFolderObject;
+					} elseif ($fileOrFolderObject instanceof t3lib_file_FileInterface) {
+						// it's a file
+						// @todo: find the parent folder, right now done a bit ugly, because the file does not
+						// support finding the parent folder of a file on purpose
+						$folderIdentifier = dirname($fileOrFolderObject->getIdentifier());
+						$selectedFolder = $fileOrFolderObject->getStorage()->getFolder($folderIdentifier);
 					}
 				}
-					// Adding upload form, if allowed
-				if ($selectedFolder) {
-					$this->content .= $this->insertUploadForm($selectedFolder);
+					// If no folder is selected, get the user's default upload folder
+				if (!$selectedFolder) {
+					$selectedFolder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
+				}
+					// Build the file upload and folder creation form
+				$uploadForm = '';
+				$createFolder = '';
+				if ($selectedFolder && !$this->isReadOnlyFolder($selectedFolder)) {
+					$uploadForm = $this->uploadForm($selectedFolder);
+					if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
+						$createFolder = $this->createFolder($selectedFolder);
+					}
+				}
+					// Insert the upload form on top, if so configured
+				if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
+					$this->content .= $uploadForm;
 				}
-
 					// Render the filelist if there is a folder selected
 				if ($selectedFolder) {
 					$files = $this->TBE_expandFolder(
@@ -851,6 +870,12 @@ class tx_rtehtmlarea_select_image extends browse_links {
 				if ($helpMessage) {
 					$this->content .= $this->getMsgBox($helpMessage);
 				}
+					// Adding create folder + upload form if applicable
+				if (!$GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
+					$this->content .= $uploadForm;
+				}
+				$this->content .= $createFolder;
+				$this->content .= '<br />';
 				break;
 			case 'dragdrop':
 				$foldertree = t3lib_div::makeInstance('TBE_FolderTree');
@@ -902,37 +927,6 @@ class tx_rtehtmlarea_select_image extends browse_links {
 		return $this->content;
 	}
 
-	/**
-	 * Create upload/create folder forms, if a folder is given
-	 *
-	 * @param t3lib_file_Folder $selectedFolder Absolute filepath on server to which to upload.
-	 * @return string HTML for an upload form.
-	 */
-	protected function insertUploadForm(t3lib_file_Folder $selectedFolder) {
-		$content = '';
-		if (!$this->readOnly) {
-				// Add upload form if allowed
-			if (!$selectedFolder) {
-				$fileStorages = $GLOBALS['BE_USER']->getFileStorages();
-				$fileStorage = reset($fileStorages);
-				$selectedFolder = $fileStorage->getRootLevelFolder();
-			}
-			if ($selectedFolder) {
-				$uploadForm = $this->uploadForm($selectedFolder);
-				$createFolder = $this->createFolder($selectedFolder);
-			} else {
-				$uploadForm = $createFolder = '';
-			}
-			if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
-				$content .= $uploadForm;
-				if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-					$content .= $createFolder;
-				}
-			}
-		}
-		return $content;
-	}
-
 	/**
 	 * Initializes the configuration variables
 	 *