4
hallo there, trying to use the uploader class, having a few probs though.
I have setup a form through php like the following
Quote:
$imagesdir = XOOPS_ROOT_PATH."/modules/../images/";
echo "";}
now in the addimage function i have this code Quote:
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
$error =0;
$allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
$maxfilesize = 50000;
$maxfilewidth = 450;
$maxfileheight = 650;
$i=0;
$imagetitle="filename";
$filename = basename($HTTP_POST_FILES[$imagetitle]['name']);
$uploader = new XoopsMediaUploader($imagesdir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($filename)) {
if (!$uploader->upload()) {
echo $uploader->getErrors();
} else {
echo 'File uploaded successfully!
';
echo 'Saved as: ' . $uploader->getSavedFileName() . '
';
echo 'Full path: ' . $uploader->getSavedDestination();
$name=$uploader->getSavedFileName();
$sql = sprintf...
}
} else {
echo $uploader->getErrors();
}
when i click the submit button all i get is there were errors during uploading and file not found. do i pass the correct parameter ($filename) to uploads()???
is this class used to any modules where i can see an example?
anyone has any ideas of what i'm doing wrong? Thanks