--- includes/file.inc  2010-08-30 21:19:31.000000000 +0200
+++ includes/file.inc  2010-08-30 22:07:19.000000000 +0200
@@ -14,6 +14,7 @@
 
 define('FILE_DOWNLOADS_PUBLIC', 1);
 define('FILE_DOWNLOADS_PRIVATE', 2);
+define('FILE_DOWNLOADS_PUBLIC_REPOSITORY', 3);
 define('FILE_CREATE_DIRECTORY', 1);
 define('FILE_MODIFY_PERMISSIONS', 2);
 define('FILE_EXISTS_RENAME', 0);
@@ -48,6 +49,8 @@
       return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
     case FILE_DOWNLOADS_PRIVATE:
       return url('system/files/'. $path, array('absolute' => TRUE));
+    case FILE_DOWNLOADS_PUBLIC_REPOSITORY:
+      return rtrim(variable_get('files_url_prefix', $GLOBALS['base_url']), '/').'/'.$path;
   }
 }
 
--- modules/system/system.admin.inc    2010-08-30 21:19:45.000000000 +0200
+++ modules/system/system.admin.inc    2010-08-30 22:07:19.000000000 +0200
@@ -1399,10 +1399,20 @@
     '#type' => 'radios',
     '#title' => t('Download method'),
     '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
-    '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
+    '#options' => array(
+              FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'),
+              FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.'),
+              FILE_DOWNLOADS_PUBLIC_REPOSITORY => t('Public repository - files are served using a specific URL prefix'),
+      ),
     '#description' => t('Choose the <em>Public download</em> method unless you wish to enforce fine-grained access controls over file downloads. Changing the download method will modify all download paths and may cause unexpected problems on an existing site.')
   );
 
+  $form['files_url_prefix'] = array(
+    '#type' => 'textfield',
+    '#title' => t('URL prefix for files'),
+    '#default_value' => variable_get('files_url_prefix', 'http://your.repository.server/some/directory/'),
+    '#description' => t('URL prefix used when generating links to files. Note that this settings will be used only if the download method is set to "Public repository".'),
+  );
   return system_settings_form($form);
 }
