1
phillipd
Base path of a pathname disappears from xoopsFormFile
  • 2005/1/26 17:42

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I'm trying to use xoopsformfile and xoopsmediauploader to upload some files. Whenever I $_POST the xoopsformfile contents all I get is the basename of the file, the dirname is missing. What am I doing wrong? I've looked at other examples from other modules and I'm doing about the same thing.

Can someone please tell me why when I POST the XoopsFormFile gadget, in my recieving script all I get is the filename without the directory path component?


Perplexed

Doug P

2
phillipd
Re: Base path of a pathname disappears from xoopsFormFile
  • 2005/1/27 15:32

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Am I asking a dumb question? This is the first question that hasn't been answered. How about if I add some source:

FORM:

$filegad = new XoopsFormFile('Attachment', 'upload_file', 2000000);
$file_tray = new XoopsFormElementTray("", " ");
$file_tray->addElement($filegad);
$entryform->addElement($file_tray);

$entryform->addElement($submit);
$entryform->addElement($button);
$entryform->display();

I select /home/phillipd/somefile.jpeg from the file selector.


REcieving script

$allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
$maxfilesize = 50000;
$maxfilewidth = 120;
$maxfileheight = 120;
$uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);

if ($uploader->fetchMedia($_POST['uploade_file'])) {
if (!$uploader->upload()) {
echo $uploader->getErrors();
} else {
echo '

File uploaded successfully!

';
echo 'Saved as: ' . $uploader->getSavedFileName() . '
';
echo 'Full path: ' . $uploader->getSavedDestination();
}
} else {
echo $uploader->getErrors();
}

If I $_POST['upload_file']; I get "somefile.jpeg". Where did the path component go?

Thanks

Doug P

Login

Who's Online

528 user(s) are online (70 user(s) are browsing Support Forums)


Members: 0


Guests: 528


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits