PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
HTTP_UPLOAD size error

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTTP
View previous topic :: View next topic  
Author Message
bumbar72



Joined: 14 Aug 2009
Posts: 1

PostPosted: Fri Aug 14, 2009 9:59 am    Post subject: HTTP_UPLOAD size error Reply with quote

Hallo!
Use HTTP_UPLOAD. How can I check the size of the file and return error?

here is the kode
Code:

$upload = new HTTP_Upload("en");
$file = $upload->getFiles("f");

if ($file->isValid()) {
   
   $file->setName ('uniq');
   
   $ext = array ("jpg", "JPG", "JPEG", "jpeg", "png", "PNG", "gif", "GIF");
   $file->setValidExtensions ($ext, "accept");
   

if ($file->getProp('size') > 50000) {
echo "This file is too large";
return;
}

Code:

   $moved = $file->moveTo('uploads/');
    if (!PEAR::isError($moved)) {
        echo 'File was moved to uploads/' . $file->getProp('name');
    } else {
        echo $moved->getMessage();
    }
} elseif ($file->isMissing()) {
    echo "No file was provided.";
} elseif ($file->isError()) {
    echo $file->errorMsg();
}



Highlighted in red works, but should not be so. I can return isError ()

How can I return isError () on the size of the file?

Thanx!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTTP All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement