打造PHP多文件带进度超级上传_PHP技巧_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

打造PHP多文件带进度超级上传

作者:黑客防线网安网站维护基地 来源:黑客防线网安网站维护基地 浏览次数:0

本篇关键词:PHPflex
黑客防线网安网讯:最近我们龙虎鹰师网安要做一个文件上传的功能,要求是可以批量上传,并且是大影音文件,于是在网上找了相关的资料和开源项目,进行了一些简单的改造。


                    trace("false");

                    }else if (filesize <= _maxFileSize){

                    r = true;

                    trace("true");

                }

               

                if (_maxFileSize == 0){

                r = true;

                }

          

            return r;

        }

       

        // restores progress bar back to normal

        private function resetProgressBar():void{

       

                  _progressbar.label = "";

                 _progressbar.maximum = 0;

                 _progressbar.minimum = 0;

        }

       

        // reset form item elements

        private function resetForm():void{

            _uploadbutton.enabled = false;

            _uploadbutton.addEventListener(MouseEvent.CLICK,uploadFiles);

            _uploadbutton.label = "Upload";

            _progressbar.maximum = 0;

            _totalbytes = 0;

            _progressbar.label = "";

            _remselbutton.enabled = false;

            _remallbutton.enabled = false;

            _browsebutton.enabled = true;

        }

       

        // whenever the _files arraycollection changes this function is called to make sure the datagrid data jives

        private function popDataGrid(event:CollectionEvent):void{               

            getByteCount();

            checkCue();

        }

       

       // enable or disable upload and remove controls based on files in the cue;       

        private function checkCue():void{

             if (_files.length > 0){

                _uploadbutton.enabled = true;

                _remselbutton.enabled = true;

                _remallbutton.enabled = true;           

             }else{

                resetProgressBar();

                _uploadbutton.enabled = false;    

             }   

        }

        // toggle upload button label and function to trigger file uploading or upload cancelling

        private function setupCancelButton(x:Boolean):void{

            if (x == true){

                _uploadbutton.label = "Cancel";

                _browsebutton.enabled = false;

                _remselbutton.enabled = false;

                _remallbutton.enabled = false;

                _uploadbutton.addEventListener(MouseEvent.CLICK,cancelFileIO);       

            }else if (x == false){

                _uploadbutton.removeEventListener(MouseEvent.CLICK,cancelFileIO);

                 resetForm();

            }

        }

       

       /*********************************************************

       *  File IO Event Handlers                                *

       *********************************************************/

     

        //  called after user selected files form the browse dialouge box.

        private function selectHandler(event:Event):void {

            var i:int;

            var msg:String ="";

            var dl:Array = [];                         

                for (i=0;i < event.currentTarget.fileList.length; i ++){

                    if (checkFileSize(event.currentTarget.fileList[i].size)){

                    _files.addItem(event.currentTarget.fileList[i]);

                    trace("under size " + event.currentTarget.fileList[i].size);

                    }  else {

                    dl.push(event.currentTarget.fileList[i]);

                    trace(event.currentTarget.fileList[i].name + " too large");

                    }

                }               

                if (dl.length > 0){

                    for (i=0;i

                    msg += String(dl[i].name + " is too large. \n");

                    }

                    mx.controls.Alert.show(msg + "Max File Size is: " + Math.round(_maxFileSize / 1024) + " kb","File Too Large",4,null).clipContent;
    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-6861-1.html
网站维护教程更新时间:2011-08-01 15:34:11  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer