ext图片上传
㈠ extjs怎样做图片上传
1.代码如下:
复制代码
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title></title>
5 <!--ExtJs框架开始-->
6 <script type="text/javascript" src="/Ext/adapter/ext/ext-base.js"></script>
7 <script type="text/javascript" src="/Ext/ext-all.js"></script>
8 <script src="/Ext/src/locale/ext-lang-zh_CN.js" type="text/javascript"></script>
9 <link rel="stylesheet" type="text/css" href="/Ext/resources/css/ext-all.css" />
10 <!--ExtJs框架结束-->
11 <script type="text/javascript">
12 Ext.onReady(function () {
13 //初始化标签中的Ext:Qtip属性。
14 Ext.QuickTips.init();
15 Ext.form.Field.prototype.msgTarget = 'side';
16 //创建div组件
17 var imagebox = new Ext.BoxComponent({
18 autoEl: {
19 style: 'width:150px;height:150px;margin:0px auto;border:1px solid #ccc; text-align:center;padding-top:20px;margin-bottom:10px',
20 tag: 'div',
21 id: 'imageshow',
22 html: '暂无图片'
23 }
24 });
25 //创建文本上传域
26 var file = new Ext.form.TextField({
27 name: 'imgFile',
28 fieldLabel: '文件上传',
29 inputType: 'file',
30 allowBlank: false,
31 blankText: '请浏览图片'
32 });
33 //提交按钮处理方法
34 var btnsubmitclick = function () {
35 if (form.getForm().isValid()) {
36 form.getForm().submit({
37 waitTitle: "请稍候",
38 waitMsg: '正在上传...',
39 success: function (form, action) {
40 Ext.MessageBox.alert("提示", "上传成功!");
41 document.getElementById('imageshow').innerHTML = '<img style="width:150px;height:150px" src="' + action.result.path + '"/>';
42 },
43 failure: function () {
44 Ext.MessageBox.alert("提示", "上传失败!");
45 }
46 });
47 }
48 }
49 //重置按钮"点击时"处理方法
50 var btnresetclick = function () {
51 form.getForm().reset();
52 }
53 //表单
54 var form = new Ext.form.FormPanel({
55 frame: true,
56 fileUpload: true,
57 url: '/App_Ashx/Demo/Upload.ashx',
58 title: '表单标题',
59 style: 'margin:10px',
60 items: [imagebox, file],
61 buttons: [{
62 text: '保存',
63 handler: btnsubmitclick
64 }, {
65 text: '重置',
66 handler: btnresetclick
67 }]
68 });
69 //窗体
70 var win = new Ext.Window({
71 title: '窗口',
72 width: 476,
73 height: 374,
74 resizable: true,
75 modal: true,
76 closable: true,
77 maximizable: true,
78 minimizable: true,
79 buttonAlign: 'center',
80 items: form
81 });
82 win.show();
83 });
84 </script>
85 </head>
86 <body>
87 <!--
88 说明:
89 (1)var imagebox = new Ext.BoxComponent():创建一个新的html标记。
90 官方解释如下:
91 This may then be added to a Container as a child item.
92 To create a BoxComponent based around a HTML element to be created at render time, use the autoEl config option which takes the form of a DomHelper specification:
93 (2) autoEl: {style: '',tag: 'div',id: 'imageshow', html: '暂无图片'}定义这个html标记的属性,如 标记为:div,id是多少等。
94 官方实例为:
95 var myImage = new Ext.BoxComponent({
96 autoEl: {
97 tag: 'img',
98 src: '/images/my-image.jpg'
99 }
100 });
101 (3)var file = new Ext.form.TextField():创建一个新的文件上传域。
102 (4)name: 'imgFile':名称,重要,因为service端要根据这个名称接收图片。
103 (5)inputType: 'file':表单类型为文件类型。
104 (6)waitTitle: "请稍候",waitMsg: '正在上传...',:上传等待过程中的提示信息。
105 (7)document.getElementById('imageshow').innerHTML = '<img style="width:150px;height:150px" src="' + action.result.path + '"/>';这个是原生态的js,把imageshow的值换成图片。
106 -->
107 </body>
108 </html>
复制代码
其中与service交互用上传图片的 一般处理程序文件,源码如下:
/App_Ashx/Demo/Upload.ashx
复制代码
1 using System;
2 using System.Web;
3 using System.IO;
4 using System.Globalization;
5
6 namespace HZYT.ExtJs.WebSite.App_Ashx.Demo
7 {
8 public class Upload : IHttpHandler
9 {
10 public void ProcessRequest(HttpContext context)
11 {
12 //虚拟目录,建议写在配置文件中
13 String strPath = "/Upload/Image/";
14 //文件本地目录
15 String dirPath = context.Server.MapPath(strPath);
16 //接收文件
17 HttpPostedFile imgFile = context.Request.Files["imgFile"];
18 //取出文件扩展名
19 String fileExt = Path.GetExtension(imgFile.FileName).ToLower();
20 //重新命名文件
21 String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
22 //文件上传路径
23 String filePath = dirPath + newFileName;
24 //保存文件
25 imgFile.SaveAs(filePath);
26 //客户端输出
27 context.Response.Write("{success:true,path:'" + strPath + newFileName + "'}");
28 }
29
30 public bool IsReusable
31 {
32 get
33 {
34 return false;
35 }
36 }
37 }
38 }
复制代码
2.效果如下:
无废话extjs
3.说明:
(1)上传域不光可以上传图片,还要以上传其他文件。这里我们以图片为例。
(2)在实际开发中,我们还要对图片格式,大小等进行校验,这个示例测重于上传,没有加入任何校验。
㈡ ext上传问题,实现效果不了
xtype : 'fileuploadfield',
buttonOnly : true,
name : 'fileInput',
style : 'text-align:left;',
buttonText : '上传Excel文件',
iconCls : 'icon_common_add',
hidden : true,
listeners: {
'fileselected' : function(fb, filename){
if(!filename.endWith('xlsx') && !filename.endWith('xls')){
Ext.Msg.alert("提示","请选择xlsx或者xls类型的文件!");
return;
}
var cpfolder = Ext.getCmp(cpFordId).getValue();
var tempType = 8;
var regionType = Ext.getCmp(qId).getValue().inputValue;
var contentPic = Ext.getCmp(contentPicId).getValue();
if(cpfolder ==''){
Ext.Msg.alert("提示","请填写CP目录");
return ;
}
if(_this.spId == '' || _this.spId == null){
Ext.Msg.alert("提示","请选择SP信息");
return ;
}
var sWhere = '?cpId='+_this.cpId+'&spId='+_this.spId+'&tempType='+tempType+'®ionType='+regionType
+'&cpfolder='+cpfolder+'&contentPic='+contentPic;
if(Ext.getCmp(searchFormId).getForm().isValid()){
Ext.getCmp(searchFormId).getForm().submit({
url : 'fileUploadAction!newExcelUpload.ds'+sWhere,
waitMsg : '正在上传中,请稍后...',
success : function(response, options){
store.removeAll();
var info = options.result.data;
var rec = new Array();
for(var a in info[0]){
var r = {name : a};
rec.push(r);
}
var RecordType = Ext.data.Record.create(rec);
var data = new Array();
for(var i=0;i<info.length;i++){
var record = {};
for(var a in info[i]){
record[a] = info[i][a];
}
var recordtype = new RecordType(record);
data.push(recordtype);
}
store.add(data);
Ext.Msg.alert("提示",'返回成功');
},
failure : function(response, options){
Ext.Msg.alert("提示",'返回失败');
}
});
}
}
}
㈢ extjs 3.4中 怎么给htmlEdit添加图片插件 实现图片上传功能
首先要使用extjs自带的HTMLEditor,然后在原有的工具条上添加一个图片按钮,点击这个图片按钮要弹出窗口,这个窗口负责实现上传功能,实现上传后,要将上传的图片路径添加到HTMLEditor的光标处,并且要以<IMG></IMG>的方式,这样HTMLEditor才能解析出来。实现代码如下:
前台JSP页面
fieldLabel : '商品特性',
id : 'shopSp.spTxms',
name : 'shopSp.spTxms',
xtype : 'StarHtmleditor',
anchor : '93%'
这其中引用了StarHtmleditor,StarHtmleditor.js的代码如下,直接将代码复制下来,然后新建个JS,全复制进去就行了。
var HTMLEditor = Ext.extend(Ext.form.HtmlEditor, {
addImage : function() {
var editor = this;
var imgform = new Ext.FormPanel({
region : 'center',
labelWidth : 55,
frame : true,
bodyStyle : 'padding:5px 5px 0',
autoScroll : true,
border : false,
fileUpload : true,
items : [{
xtype : 'textfield',
fieldLabel : '选择文件',
id : 'UserFile',
name : 'UserFile',
inputType : 'file',
allowBlank : false,
blankText : '文件不能为空',
anchor : '90%'
}],
buttons : [{
text : '上传',
handler : function() {
if (!imgform.form.isValid()) {return;}
imgform.form.submit({
waitMsg : '正在上传......',
url : 'HTMLEditorAddImgCommonAction.action',
success : function(form, action) {
var element = document.createElement("img");
element.src = action.result.fileURL;
if (Ext.isIE) {
editor.insertAtCursor(element.outerHTML);
} else {
var selection = editor.win.getSelection();
if (!selection.isCollapsed) {
selection.deleteFromDocument();
}
selection.getRangeAt(0).insertNode(element);
}
//win.hide();//原始方法,但只能传一个图片
//更新后的方法
form.reset();
win.close();
},
failure : function(form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告','上传失败',action.result.errors.msg);
}
});
}
}, {
text : '关闭',
handler : function() {
win.close(this);
}
}]
})
var win = new Ext.Window({
title : "上传图片",
width : 300,
height : 200,
modal : true,
border : false,
iconCls : "picture.png",
layout : "fit",
items : imgform
});
win.show();
},
createToolbar : function(editor) {
HTMLEditor.superclass.createToolbar.call(this, editor);
this.tb.insertButton(16, {
cls : "x-btn-icon",
icon : "picture.png",
handler : this.addImage,
scope : this
});
}
});
Ext.reg('StarHtmleditor', HTMLEditor);
JS的第一句var HTMLEditor = Ext.extend(Ext.form.HtmlEditor, 网上是没有var的,不用var不知道为什么总是报错,另外JS一定要与JSP的编码方式一致,要不然报莫名其妙的错误,而且错误都没有显示。
后台java代码
/****
* HTMLEditor增加上传图片功能:
* 1、上传图片后,需要将图片的位置及图片的名称返回给前台HTMLEditor
* 2、前台HTMLEditor根据返回的值将图片显示出来
* 3、进行统一保存
* @param 上传图片功能
* @return JSON结果
* @throws IOException
*/
public void HTMLEditorAddImg() throws IOException {
if(!"".equals(UserFile) && UserFile != null && UserFile.length() > 0){
File path = ImportImg(UserFile, "jpg");
UserFilePath = "../" + path.toString().replaceAll("\\", "/").substring(path.toString().replaceAll("\\", "/").indexOf("FileImg"));
}
this.getResponse().setContentType("text/html");
this.getResponse().getWriter().write("{success:'true',fileURL:'" + UserFilePath + "'}");
}
特别要注意的是路径问题,路径问题主要有2点需要注意:
1、前台页面引用StarHtmleditor.js的路径一定要正确;
2、Htmleditor上传的图片路径一定要改,因为上传之后图片路径变为http://localhost:8080/,在正常使用中图片不显示,要将该地址替换为服务器的IP地址;替换方法如下:
//获取本地IP地址,因为extjs的htmleditor上传的照片路径有问题,需要将路径替换为本机IP地址
InetAddress inet = InetAddress.getLocalHost();
shopSp.setSpTxms(shopSp.getSpTxms().replace("localhost", inet.getHostAddress().toString()));
这样基本就完成了这个HTMLEditor上传图片功能。
如图:
㈣ extjs怎么使图片上传时显示预览
这个我做过,不难,思路给你 1.是当文本框内容发生改变的时候就将图片上传到服务器(如果图片小,用户是感觉不到你已经做了上传操作的。) 2.当服务器接受到这个图片的时候,将其放入到一个临时文件夹中并返回给前台一个图片路径(图片流也可以)。 3.Ajax请求会有一个相应,在服务器端成功接受到上传的图片后,返回给Ajax一个Reponse,这个Reponse里包含一个图片路径。 4.ExtJS在前台获取success里的responseText之后(也就是图片路径)将默认图片的src指向从后台反馈回来的图片路径。 现在图片就会现实出来流程是:用户选择图片--> 触发文本框改变事件---> 在事件中通过AJAX将图片上传给服务器---> 服务器将图片名称修改为UUID以免重复,并将此图片的路径返回给前台---> 前台AJAX请求的回调函数中获取responseText,也就是图片路径---> 设置默认图片的src为responseText----> 用户重新选择的时候(例如用户不喜欢这张图)---> 在文本框改变事件中通过AJAX将图片上传(包括先前上传的图片名称)---> 后台根据参数先删除临时图片---> 重复以上的步骤直到用户确定 需要注意的问题: 1.当用户改变了图片之后,需要把上一次的临时图片文件删除掉,以免出现垃圾图片过多。 2.每次上传图片的时候要在后面跟上一个随机参数(因为如果请求路径和参数相同,浏览器不会再继续发送请求)。通常情况下使用new Date()就可以了例如 "uploadImag.do?method=uploadImage&randomParam="+new Date() 3.图片太大的话,效果不是很好。 4.当用户点击确定后,将临时文件里的图片放置到你的正式图片存放目录下即可。
㈤ ExtJs中怎么上传文件
下面为大家介绍在ExtJs中上传文件的几种方法
第一种方法:传统的上传方式
在formpanal中增加一个fileUpload的属性
例子代码:
JScript 代码 复制
Ext.onReady(function(){
var form = new Ext.form.FormPanel({
renderTo:'file',
labelAlign: 'right',
title: '文件上传',
labelWidth: 60,
frame:true,
url: 服务器处理上传功能的url地址,//fileUploadServlet
width: 300,
height:200,
fileUpload: true,
items: [{
xtype: 'textfield',
fieldLabel: '文件名',
name: 'file',
inputType: 'file'//文件类型
}],
buttons: [{
text: '上传',
handler: function() {
form.getForm().submit({
success: function(form, response){
Ext.Msg.alert('信息', response.result.msg);
},
failure: function(){
Ext.Msg.alert('错误', '文件上传失败');
}
});
}
}]
});
});
第二种方法:借助Ext.ux.UploadDialog.Dialog的组件,在编码时需要导入两个文件
需要引入 Ext.ux.UploadDialog 样式文件 和 Ext.ux.UploadDialog.packed脚本文件。
例子代码
//在使用此方法进行文件上传时,其后台往页面的返回值类型是这样的:
//{'success':true,'message':'上传成功'}
//如果没有success:true,无论上传成功与否,显示的都是上传失败,其实这个和form.submit()的提交方式是一个道理。
var dialog = new Ext.ux.UploadDialog.Dialog({
autoCreate: true,
closable: true,
collapsible: false,
draggable: true,
minWidth: 400,
minHeight: 200,
width: 400,
height: 350,
permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','xls','XLS'],
proxyDrag: true,
resizable: true,
constraintoviewport: true,
title: '文件上传',
url:用于处理上传文件功能的Url,
reset_on_hide: false,
allow_close_on_upload: true ,
upload_autostart: false
});
//定义上传文件的按钮
var btnShow = new Ext.Button({
text:'上传文件',
listeners:{
click:function(btnThis,eventobj){
dialog.show();
}
}
});
㈥ ext js 浏览控件(上传图片功能)
用js或者提交后后台检测fileExt。
js:
<script language="JavaScript" type="text/JavaScript">
var img=null;
function checkPic(Form1){
var location=Form1.pic.value;
if(location==""){
alert("友情提示:\n\n请先选择图片文件,然后再点击“上传照片”按钮。");
window.location.href=window.location.href;
return false;
}
var point = location.lastIndexOf(".");
var type = location.substr(point);
if(type==".jpg"||type==".gif"||type==".png"||type==".JPG"||type==".GIF"||type==".PNG"){
img=document.createElement("img");
img.style.position="absolute";
img.style.visibility="hidden";
document.body.insertAdjacentElement("beforeend",img);
img.src=location;
//if(img.fileSize>35540)
if(img.fileSize>102400) {
alert("友情提示:\n\n您上传的图片尺寸超过了网站的限定,请不要大于102400字节,宽度小于450px。\n\n您目前上传的图片宽度:"+img.offsetWidth+"px,高度:"+img.offsetHeight+"px,图片大小:"+img.fileSize+"字节。\n\n请调整到规定大小再上传!谢谢合作!");
window.location.href=window.location.href;
return false;
}else
return true;
}
else{
alert("友情提示:您要上传的图片格式不对!\n\n只能输入jpg、png或者gif格式的图片,\n\n请重新选择图片!谢谢合作!");
window.location.href=window.location.href;
return false;
}
return true;
}
function changesrc(){
yourpic.src=Form1.pic.value;
}
</script>
后台:
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
filepath=trim(upload.form("filepath"))
filelx=trim(upload.form("filelx"))
i=0
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if file.filesize<100 then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if (filelx<>"swf") and (filelx<>"jpg") then
'response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'response.end
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('友情提示:\n\n您上传出错啦!该文件类型不能上传!\n\n请重新选择文件再上传,请点击“确定”重新输入!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
end if
if filelx="swf" then
if fileext<>"swf" then
'response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传swf格式的Flash文件![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'response.end
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('友情提示:\n\n您上传出错啦!只能上传swf格式的Flash文件!\n\n请重新选择文件再上传,请点击“确定”重新输入!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
end if
end if
if filelx="jpg" then
if fileext<>"gif" and fileext<>"jpg" and fileext<>"png" then
'response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'response.end
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('友情提示:\n\n您上传出错啦!只能上传jpg、png或gif格式的图片!\n\n请重新选择文件再上传,请点击“确定”重新输入!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
end if
end if
if filelx="swf" then
if file.filesize>(3000*1024) then
'response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3M 的Flash文件![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'response.end
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('友情提示:\n\n您上传出错啦!最大只能上传 300k 的Flash文件!\n\n请重新选择文件再上传,请点击“确定”重新输入!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
end if
end if
if filelx="jpg" then
if file.filesize>(200*724) then
'response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 1000K 的图片文件![ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'response.end
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('友情提示:\n\n您上传的图片尺寸超过了网站的限定,最大只能上传 600K 的图片文件!\n\n请将图片调整到宽度为:450px,小于规定大小再上传!\n\n请点击“确定”重新输入!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
end if
end if
%>
要注意与上传控件一起配合好才行的。 有问题找偶。
㈦ ext js 上传图片控件
在服务端判断了,假设你的客户端控件 name = ”photo-path“
服务端可以写成以下:
HttpPostedFile postedFile = Request.Files["photo-path"];//获取上传信息对象
string filename = postedFile.FileName;//获取上传的文件路径
string sExtension = filename.Substring(filename.LastIndexOf('.'));//获取拓展名
然后就可以判断是否正确了,但是通过扩展名判断文件类型比较不靠谱了,因为扩展名是可以变更的。
㈧ 你有个EXT上传图片到panel控件的小例子没,给看看,谢谢了
EXT上传图片是上传到数据库,panel是从数据库获取图片的路径显示,不是直接把图片上传到panel里,一般没有这种小例子,小例子都是单纯一种功能的,单纯的上传或者单传的加载图片
㈨ 图片上传的代码
<%@ language="javascript"%>
<%
var self = Request.serverVariables("SCRIPT_NAME");
if (Request.serverVariables("REQUEST_METHOD")=="POST")
{
var oo = new uploadFile();
oo.path = "myFile"; //存放路径,为空表示当前路径,默认为uploadFile
oo.named = "file"; //命名方式,date表示用日期来命名,file表示用文件名本身,默认为file
oo.ext = "all"; //允许上传的扩展名,all表示都允许,默认为all
oo.over = true; //当存在相同文件名时是否覆盖,默认为false
oo.size = 1*1024*1024; //最大字节数限制,默认为1G
oo.upload();
Response.write('<script type="text/javascript">location.replace("'+self+'")</script>');
}
//ASP无组件上传类
function uploadFile()
{
var bLen = Request.totalBytes;
var bText = Request.binaryRead(bLen);
var oo = Server.createObject("ADODB.Stream");
oo.mode = 3;
this.path = "uploadFile";
this.named = "file";
this.ext = "all";
this.over = false;
this.size = 1*1024*1024*1024; //1GB
//文件上传
this.upload = function ()
{
var o = this.getInfo();
if (o.size>this.size)
{
alert("文件过大,不能上传!");
return;
}
var f = this.getFileName();
var ext = f.replace(/^.+\./,"");
if (this.ext!="all"&&!new RegExp(this.ext.replace(/,/g,"|"),"ig").test(ext))
{
alert("目前暂不支持扩展名为 "+ext+" 的文件上传!");
return;
}
if (this.named=="date")
{
f = new Date().toLocaleString().replace(/\D/g,"") + "." + ext;
}
oo.open();
oo.type = 1;
oo.write(o.bin);
this.path = this.path.replace(/[^\/\\]$/,"$&/");
var fso = Server.createObject("Scripting.FileSystemObject");
if(this.path!=""&&!fso.folderExists(Server.mapPath(this.path)))
{
fso.createFolder(Server.mapPath(this.path));
}
try
{
oo.saveToFile(Server.mapPath(this.path+f),this.over?2:1);
alert("上传成功!");
}
catch(e)
{
alert("对不起,此文件已存在!");
}
oo.close();
delete(oo);
}
//获取二进制和文件字节数
this.getInfo = function ()
{
oo.open();
oo.type=1;
oo.write(bText);
oo.position = 0;
oo.type=2;
oo.charset="unicode";
var gbCode=escape(oo.readText()).replace(/%u(..)(..)/g,"%$2%$1");
var sPos=gbCode.indexOf("%0D%0A%0D%0A")+12;
var sLength=bLen-(gbCode.substring(0,gbCode.indexOf("%0D%0A")).length/3)-sPos/3-6;
oo.close();
oo.open();
oo.type = 1;
oo.write(bText);
oo.position=sPos/3;
var bFile=oo.read(sLength);
oo.close();
return { bin:bFile, size:sLength };
}
//获取文件名
this.getFileName = function ()
{
oo.open();
oo.type = 2;
oo.writeText(bText);
oo.position = 0;
oo.charset = "gb2312";
var fileName = oo.readText().match(/filename=\"(.+?)\"/i)[1].split("\\").slice(-1)[0];
oo.close();
return fileName;
}
function alert(msg)
{
Response.write('<script type="text/javascript">alert("'+msg+'");</script>');
}
}
%>
<html>
<head>
<title>ASP无组件上传类</title>
<meta http-equiv="content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form action="<%=self%>" method="post" enctype="multipart/form-data" onSubmit="return (this.upFile.value!='');">
<input type="file" name="upFile"/>
<input type="submit" value="上传文件"/>
</form>
</body>
</html>
㈩ ext js 浏览控件(上传图片功能),上传上的图片怎么能显示在panel控件上,求解释
更改了panel的背景图片