Qeephp Helper_uploader Class

Source: Internet
Author: User

Helper_uploader encapsulates a number of actions for uploading files

Existsfile () determines whether an uploaded object of the specified name exists

File () Gets the Files object

IsValid () Determine if the file object conforms to the check condition

Move () Moves the file object to the specified directory

Usage:

functionActionimportxls () {if(Request_is_post ()) {$uploader=NewHelper_uploader (); if($uploader->existsfile (' Mubanxls ')){                if($uploader-file(' Mubanxls ')->isvalid (' xls ', 10485760)) {//10M                    Set_time_limit(0); $uploadtmp _dir=index_dir. '/_tmp1010/uploadtmp/'; Helper_filesys:: Mkdirs ($uploadtmp _dir); $filenamebase=Date(' Ymd-his ').$this->_login_user[' Parent_uid '. xls; $filename=$uploadtmp _dir.$filenamebase; $uploader-file(' Mubanxls ')->move ($filename); //Analysis//return $this->_redirect (url ('/importxlshelper ', array (' filename ' = = $filenamebase, ' Use_sku_for_                    Imgshow ' =>request (' use_sku_for_imgshow '))); LXB 2013828
$this->actionimportxlshelper ($filenamebase, request (' Use_sku_for_imgshow ')); }Else{ $this->_view[' error ']= ' <div class= ' error ' > The file you uploaded is not properly formatted, must be in XLS format, or the file is too large! </div> "; } }Else{ $this->_view[' error ']= ' <div class= ' error ' > Please upload the file correctly! </div> "; } } }

Qeephp Helper_uploader Class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.