345
Well, I decided to expand on the upload and extract module, module/hack. One problem, I cant get the upload to work correctly. Ive got the upload code stored in a function, and it seems to hit the function properly, but it errors out as soon as I submit something.... By error out, I mean that it doesn't submit anything and displays the canned error message.
Here is the code..
<code>
function xoopsmoduleupload() {
global $HTTP_POST_VARS;
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('text/html', 'application/x-cdf', 'text/plain'), 2000000);
$uploader->setPrefix('tmp');
if ($uploader->fetchMedia($HTTP_POST_VARS['upload_file_name'][0])) {
if (!$uploader->upload()) {
$err = $uploader->getErrors();
} else {
echo '<h4>File uploaded successfully!</h4>';
echo 'Saved as: ' . $uploader->getSavedFileName() . '<br />';
echo 'Full path: ' . $uploader->getSavedDestination();
redirect_header("unzip.php",1,'Module Successfully Uploaded <br> Saved as: $uploader->getSavedFileName() <br> Full path: $uploader->getSavedDestination()' );
}
} else {
redirect_header("unzip.php",1,$uploader->getErrors());
echo $uploader->getErrors();
}
}
</code>
What am I doing wrong here?
Thanks for the help,