2013-03-20 104 views

回答

2

有一個很好的擴展,你可以使用這個。這在3.4的例子中。

File Upload Field Example

FileUploadField.js fileuploadield.css

jsFiddle example

Ext.onReady(function() { 


    new Ext.Viewport({ 


     layout: 'fit', 
     items: [ 
      { 
       xtype: 'form', 
       items: [ 
        { 
         xtype: 'textfield', 
         fieldLabel: 'Textfield with inputType=file', 
         inputType: 'file' 
        }, 
        { 
         xtype: 'fileuploadfield', 
         width: 200, 
         emptyText: 'Select a file', 
         fieldLabel: 'FileUploadField UX', 
         name: 'blah-blah', 
         buttonText: 'Custom Text' 
        } 
       ], 

       title: 'Form' 
      } 
     ] 
    }); 

}); 
0
<html> 
<head> 
</head> 
<body> 
<form> 
<input type=text name=file style="width:60px"> 
<input type=file name=newfile style="display:none"> 
<input type=button onClick="newfile.click();file.value=newfile.value; " value="import from excel"> 
</form> 
</body> 
</html>