{
string path=Server.MapPath("Upcptp");
string y=DateTime.Now.Year.ToString();
string m=DateTime.Now.Month.ToString();
string d=DateTime.Now.Day.ToString();
string h=DateTime.Now.Hour.ToString();
string n=DateTime.Now.Minute.ToString();
string s=DateTime.Now.Second.ToString();
string filename=y+m+d+h+n+s;
Random r=new Random();
filename=filename+r.Next(1000);
filename=filename+"."+upload_file.PostedFile.FileName.Substring(upload_file.PostedFile.FileName.Length-3);
string FN="Upcptp/"+filename;
filename=path+"/"+filename;
upload_file.PostedFile.SaveAs(filename);
if (fileEXT=="gif")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");
}
else if(fileEXT=="jpg")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>"); }
upload_file.Visible=false;
Button1.Visible=false;
Info.InnerHtml="成功上传一个文件点击 <a href=Upcptp.aspx>这儿</a> 继续上传";
Info.Visible=true;
}
else
{
Info.Visible=true;
}
}
我通过以上代码上传文件 为什么
if (fileEXT=="gif")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");
}
else if(fileEXT=="jpg")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>"); }
这两句都没起作用这样写是否有错呢?
string path=Server.MapPath("Upcptp");
string y=DateTime.Now.Year.ToString();
string m=DateTime.Now.Month.ToString();
string d=DateTime.Now.Day.ToString();
string h=DateTime.Now.Hour.ToString();
string n=DateTime.Now.Minute.ToString();
string s=DateTime.Now.Second.ToString();
string filename=y+m+d+h+n+s;
Random r=new Random();
filename=filename+r.Next(1000);
filename=filename+"."+upload_file.PostedFile.FileName.Substring(upload_file.PostedFile.FileName.Length-3);
string FN="Upcptp/"+filename;
filename=path+"/"+filename;
upload_file.PostedFile.SaveAs(filename);
if (fileEXT=="gif")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");
}
else if(fileEXT=="jpg")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>"); }
upload_file.Visible=false;
Button1.Visible=false;
Info.InnerHtml="成功上传一个文件点击 <a href=Upcptp.aspx>这儿</a> 继续上传";
Info.Visible=true;
}
else
{
Info.Visible=true;
}
}
我通过以上代码上传文件 为什么
if (fileEXT=="gif")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");
}
else if(fileEXT=="jpg")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>"); }
这两句都没起作用这样写是否有错呢?
解决方案 »
- 未能加载文件或程序集“System.Web.Extensions, Version=2.0.0.0
- 用window.open打开新窗口怎么指定最大化和坐标?
- TreeView
- ASP.Net服务器控件导致页面频繁刷新有好的解决方法么?在线等
- 这个东西是怎么实现的呢?
- fckeditor控件的宽度怎么设置啊 哪位大虾告诉我
- 如何用javascript为TreeView添加节点,删除节点?谢谢...........
- 请问如何把大量现存的文档录入数据库?(详见内,谢谢)
- 我做了一个基于web的asp.net的小项目,应如何把他变成.exe文件,然后可以在task schedule 中运行??
- 怎么在xsl模板里写一个form,把其中的内容传送给其他的aspx文件?
- 有谁能介绍一下Regsvr32 的用法
- 我的DataGrid如果把头(页眉)去掉,这样每项设的宽度就会不起作用,如何解决。。。
建议设置一个label来设置FN,
并通过使用findcontrol来更改这个label的text属性
int i= nam.LastIndexOf(".");
string newext =nam.Substring(i).Trim ();
if (newext == ".gif")
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");}
elseif((newext == ".jpg") )
{
Response.Write("<"+"script>window.parent.cp_edit.dlList__ct3_cptp.Text='"+FN+"'</"+"script>");
}
看看可不可以
建议看下这个:http://www.cnblogs.com/zxjnet/articles/23812.aspx