Importing FTP uploaded photos into gallery

From FundaWiki

Jump to: navigation, search

Due to PHP safemode restrictions on many web-hotels it is not possible to upload photos into the fundanemt/site_graphics/fundaGallery/upload folder, and you thus have to uploade one file at a time using the file browser.

Until a better solution is found (by specifing the upload folder to use) the following "hack" can be used to allow FTP uploads of photos and importing them into the upload directory.

  $handle = opendir($_SERVER["DOCUMENT_ROOT"]."/incoming/");
  while (false !== ($file = readdir($handle))) {
    if (preg_match("/jpg$/i", $file)) {
      copy($_SERVER["DOCUMENT_ROOT"]."/incoming/".$file, $_SERVER["DOCUMENT_ROOT"]."/fundanemt/site_graphics/fundaGallery/upload/".$file);
    }
  }
  1. Create a folder on the webserver named "incoming"
  2. Insert this in a PHP file and upload it to the web server, or create a locked fundanemt page, which is only accessible when you are logged into Fundanemt.
Personal tools