Code samples for upload?

92 views
Skip to first unread message

mywebwork

unread,
Oct 16, 2009, 5:26:07 PM10/16/09
to jsLINB
Hi

I was wondering if anyone has a sample code snippet for using the
combo box as an upload control? I'm struggling to get this to work
and would appreciate any help. Ideally I'd like to see both the
JavaScript and the PHP server-side code.

Many Thanks

Bill

JustGo

unread,
Oct 18, 2009, 8:32:12 PM10/18/09
to jsLINB

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){
linb.IAjax('../request.php',{file:file},function(rsp){
linb.alert(rsp.data.message);
},function(errMsg){
linb.alert(errMsg)
}).start();
}
}
}
});



<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES
["file"]["name"]);
$id = $_POST["id"];
echo "<script>window.name=\"{id:'".$id."',data:{message:'ok'}}\"</
script>"
?>

Wawan Cenggoro

unread,
Mar 20, 2013, 10:55:29 PM3/20/13
to li...@googlegroups.com
How can I use those code? I try to copying the js codes on a file named upload.js and copying the php codes on a file named request.php on the same folder. but it didn't work. Instead, the program return the error message "Error: IAjax no return value"

Jack Lee

unread,
Mar 21, 2013, 9:29:58 PM3/21/13
to li...@googlegroups.com

Wawan Cenggoro

unread,
Mar 22, 2013, 9:26:18 PM3/22/13
to li...@googlegroups.com
Thanks, I'll give it a try

elaya rajad

unread,
Apr 17, 2013, 9:01:03 AM4/17/13
to li...@googlegroups.com
Hi Lee,

How to upload a file with IAjax with java serlvet or JSP. I tried with servlet. Its is not accepting the request. Please give me the servlet sample or jsp sample.

WWR

Elayaraja.D

Jack Lee

unread,
Apr 17, 2013, 10:04:15 AM4/17/13
to li...@googlegroups.com

elaya rajad

unread,
Apr 17, 2013, 2:14:48 PM4/17/13
to li...@googlegroups.com
Hi Lee,
 
Sorry i dont know php, i am aware about java only, please give some example in servlet for this IAJax.
 
WWR
 
Elayaraja.d
Reply all
Reply to author
Forward
0 new messages