Tuesday 21 December 2004 3:00:11 am
Hi! I'm making a module that will read a uploaded tab-separated textfile and store it in a db-table. I thought I'd understood the eZHTTPFile, but I can't make it work. The template-form has <input type="file" name="FileToImport">
Here is some of my modulecode:
<?php
include_once('kernel/common/template.php');
include_once('lib/ezutils/classes/ezhttpfile.php');
$tpl =& templateInit();
$module =& $Params['Module'];
$debug='';
if ( $module->isCurrentAction( 'store' ) )
{
$debug = 'Action=store';
if ( eZHTTPFile::canFetch( 'FileToImport' ) )
{
$debug='canFetch=1';
$file =& eZHTTPFile::fetch( 'FileToImport' );
if ( $file )
{
$debug='Fetched!';
}
}
}
$tpl->setVariable('debug', $debug);
// Build module result array
$Result = array();
$Result['content'] = $tpl->fetch("design:dailyword/storefile.tpl");
$Result['path'] = array( array( 'url' => '/dailyword/import',
'text' => "Import to database") );
?>
This code result in $debug being set to 'Action=store'. I.e. it cant fetch the file. Any ideas? Roy
|