diff --git a/e107_admin/image.php b/e107_admin/image.php
index 570ae6943..df7ee65f0 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -937,6 +937,8 @@ class media_admin_ui extends e_admin_ui
$mes->addDebug("For:".$cat);
$mes->addDebug("Bbcode: ".$this->getQuery('bbcode'));
+
+
if($file)
{
@@ -976,12 +978,26 @@ class media_admin_ui extends e_admin_ui
function uploadPage()
{
if(!ADMIN){ exit; } //TODO check for upload-access in perms.
+
+
+
// if 'for' has no value, files are placed in /temp and not added to the db.
$text = '
';
+ $frm = e107::getForm();
+
+ $text .= $frm->open('upload-url-form','post');
+ $text .= '";
+
return $text;
}
@@ -1588,7 +1604,16 @@ class media_admin_ui extends e_admin_ui
$frm = e107::getForm();
$mes = e107::getMessage();
$fl = e107::getFile();
-
+
+ if(vartrue($_POST['upload_remote_url']))
+ {
+ if(!$fl->getRemoteFile($_POST['upload_url'], basename($_POST['upload_url']), 'import'))
+ {
+ $mes->addError("There was a problem grabbing the file");
+ }
+ }
+
+
$fl->setFileInfo('all');
$rejectArray = array('^\.ftpquota$','^index\.html$','^null\.txt$','\.bak$','^.tmp','.*\.xml$','^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','^\.htaccess$','index\.html','null\.txt');
$fl->setFileFilter($rejectArray);
diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php
index 95ee7fbe2..12e322979 100644
--- a/e107_handlers/file_class.php
+++ b/e107_handlers/file_class.php
@@ -318,7 +318,9 @@ class e_file
/**
* Grab a remote file and save it in the /temp directory. requires CURL
- *
+ * @param $remote_url
+ * @param $local_file
+ * @param $type media, temp, or import
* @return boolean TRUE on success, FALSE on failure (which includes absence of CURL functions)
*/
function getRemoteFile($remote_url, $local_file, $type='temp')
@@ -335,6 +337,11 @@ class e_file
$path = ($type == 'media') ? e_MEDIA : e_TEMP;
+ if($type == 'import')
+ {
+ $path = e_IMPORT;
+ }
+
$fp = fopen($path.$local_file, 'w'); // media-directory is the root.
$cp = curl_init($remote_url);