PDA

View Full Version : File Upload



nityajs
19 Aug 2009, 6:34 PM
Hi All,

I am trying to use the file upload example given below url. I am using the third example in the link to upload file.
http://extjs.com/deploy/dev/examples/form/file-upload.html

Problem is when I select an image, the complete file path is not displayed in the text instead only file name with extension is displayed. For example: test.jpg is displayed instead of c:\temp\test.jpg

I need the complete path in the textfield. Is it possible? Please help me out. I am trying to see many posts in the forum but no luck...any hint would be highly appreciated.

Here is my code:


var testForm = new Ext.form.FormPanel({
frame : true,
title : 'Misc/Attachments',
fileUpload: true,
msgTarget: 'side',
collapsible : false,
width : 100,
height: 500, //new height to cover space
xtype : 'form',
items:[
{layout:'form',items:[{ xtype:"textfield", fieldLabel:'test#',id:"testIdMisc",disabled:true}]},
{
layout:"column",
//bodyStyle:'padding:0 18px 0 0' ,
layoutConfig: {
columns: 1
},
items:[ {
columnWidth:1.0,
layout:"form",
border : true,
items:[
{
xtype: 'fileuploadfield',
id: 'doc-file',
emptyText: 'Select an doc',
fieldLabel: 'Doc Link',
name: 'testDocLink',
anchor: '95%',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
} ,
{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Image Link',
name: 'photo-path',
anchor: '95%',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
}
]
}],
buttonAlign: 'left',
buttons: [{
text: 'Upload',
handler: function(){
Ext.Msg.alert('test...',Ext.get('form-file').getValue());
//if(fp.getForm().isValid()){

testForm.getForm().submit({
url: contextPath +"/test?op=uploadFile&filePath="+Ext.get('form-file').getValue(),
waitMsg: 'Uploading Image file...',
success: function(testForm, o){
msg('Success', 'Processed file "'+o.result.file+'" on the server');
}
});
//}
}
}
]
}]
});