Ok fixed the PEAR problem, now it seems to work without problem,
however the file is not being uploaded for some reason. Where should i
be adding the upload folder? Am i correct in putting the folder as
cake/app/uploads? thanks
View:
<form action="<?php echo $html->url('/cars/addfile'); ?>"
method="post" enctype="multipart/form-data">
<input type="file" name="userfile" />
<?php echo $html->submit('Add');?>
</form>
Controller:
function addfile() {
vendor('Upload');
$upload = new HTTP_Upload("en");
$file = $upload->getFiles("userfile");
if ($file->isValid()) {
$moved = $file->moveTo("uploads/");
if (!PEAR::isError($moved)) {
$this->flash("File was moved to uploads ", '/uploads/');
exit;}
else if (PEAR::isError($moved)) {
$this->flash("File not successful", null);
exit;
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---