sample file to read file with delimited

48 views
Skip to first unread message

sam zr

unread,
Apr 5, 2013, 12:54:19 PM4/5/13
to li...@googlegroups.com


i want to use delimited file to upload data with jslinb,
is there any simple sample with that.?

thanks before

Jack Lee

unread,
Apr 6, 2013, 11:36:26 PM4/6/13
to li...@googlegroups.com
jsLinb Class code:
---------------------------------
Class('App', 'linb.Com',{
    Instance:{
        iniComponents:function(){
            // [[code created by jsLinb UI Builder
            var host=this, children=[], append=function(child){children.push(child.get(0))};
       
            append((new linb.UI.SLabel)
                .host(host,"slabel1")
                .setLeft(40)
                .setTop(44)
                .setCaption("Select your file: ")
            );
           
            append((new linb.UI.ComboInput)
                .host(host,"upload")
                .setLeft(140)
                .setTop(40)
                .setWidth(140)
                .setReadonly(true)
                .setType("upload")
                .setValue("Select a file ...")
            );
           
            append((new linb.UI.SButton)
                .host(host,"sbutton3")
                .setLeft(290)
                .setTop(40)
                .setCaption("Upload it")
                .onClick("_sbutton3_onclick")
            );
           
            return children;
            // ]]code created by jsLinb UI Builder
        },
        _sbutton3_onclick:function (profile, e, src, value) {
            var file=this.upload.getUploadObj();
            if(file){
                // backend service: request.php
                linb.request('request.php',{file:file},function(rsp){
                    linb.alert(rsp.data.message);
                },function(errMsg){
                    linb.alert(errMsg)
                }).start();
            }
        }
    }
});
----------------------------------------
backend php code
----------------------------------------
  <?php 
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
echo "<script>window.name=\"{id:'".$_POST["id"]."',data:{message:'ok'}}\"</script>"
  ?>
Reply all
Reply to author
Forward
0 new messages