Posting at the PHPList Forum: PHPlist Forum Index -> Docs, Tips and Tricks Quick Hack. Importing without file uploading. ================================================================= mariovaldez Joined: 01 Jul 2004 Posts: 1 ================================================================= Posted: Thu Jul 01, 2004 9:04 am Post subject: Quick Hack. Importing without file uploading. ================================================================= Hi. I was moving an old mailing list from MailMan to PhpList but when trying to import my old user list, I couldn't. After some minutes struggling with the importing procedure (because my hosting company is using PHP in safe-mode), I decided to change the way I load the user list. Why to upload a file when you can just copy-paste the user list in a textarea? (I was importing with the option "import emails with the same values for attributes"). So I edited the script file admin/import1.php to make it display a textarea where I can just paste or write directly the emails to import. For a screenshot check this: http://www.mariovaldez.net/files/phplist_import.png The changes are as follow (I'm using version 2.8.8 of PhpList): Deleted this from line 23 to 38: Code: ----------------------------------------------------------------- if(!$_FILES["import_file"]) { Fatal_Error("File is either too large or does not exist."); return; } if(empty($_FILES["import_file"])) { Fatal_Error("No file was specified. Maybe the file is too big? "); return; } if (filesize($_FILES["import_file"]['tmp_name']) > 1000000) { Fatal_Error("File too big, please split it up into smaller ones"); return; } if( !preg_match("/^[0-9A-Za-z_\.\-\/\s \(\)]+$/", $_FILES["import_file"]["name"]) ) { Fatal_Error("Use of wrong characters: ".$_FILES["import_file"]["name"]); return; } ----------------------------------------------------------------- and added this at that place: Code: ----------------------------------------------------------------- if(!($_POST["import_elist"])) { Fatal_Error("No list was specified."); return; } ----------------------------------------------------------------- Substitute this code (around line 32): Code: ----------------------------------------------------------------- if ($_FILES["import_file"]) { move_uploaded_file($_FILES['import_file']['tmp_name'], $GLOBALS['tmpdir'].'/'. $_FILES['import_file']['name']); if( !($fp = fopen ($GLOBALS['tmpdir'].'/'. $_FILES['import_file']['name'], "r"))) Fatal_Error("The file ".$_FILES['import_file']['tmp_name']." is not readable !"); $email_list = fread($fp, filesize ($_FILES["import_file"]['tmp_name'])); fclose($fp); unlink($_FILES["import_file"]['tmp_name']); } ----------------------------------------------------------------- Using this: Code: ----------------------------------------------------------------- if ($_POST["import_elist"]) { $email_list = $_POST["import_elist"]; } ----------------------------------------------------------------- And change lines 278 and 279: Code: -----------------------------------------------------------------