解决方案 »
- jQuery问题-当鼠标移上去时就显示出图片(急)
- 小 白 求助
- treeview控件如何强制刷新
- gridview 列排序、编辑、删除等操作 状态栏老显示JAVASCRIPT:_DOPOSTBACK
- 数据库中存放图片地址 如何读取图片
- .Net UpLoad 上传
- 打开的网页过几分钟就过期了怎么办??急!在线等........
- 请教,含atlas的网页在框架中执行时会全页刷新的问题
- 想做一个农产品交易的网站,大家给点意见,来者有分啊
- 思归等高手请进:比较Server Control和Html Control
- Repeater控件 页面刷新后,数据重复绑定
- CS0103: The name 'DAL' does not exist in the current context
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Web.SessionState;
using System.Web;public class UploadHandler : IHttpHandler, IRequiresSessionState
{ public void ProcessRequest(HttpContext context)
{
if (context.User.Identity.IsAuthenticated)
{
context.Response.ContentType = "text/plain"; HttpPostedFile file = context.Request.Files["Filedata"];
string uploadPath = HttpContext.Current.Server.MapPath("/UpFiles") + "/pic/";
string uploadPath2 = "/UpFiles" + "/pic/";
if (file != null)
{
//检测文件类型
if (ConfigurationManager.AppSettings["AllowedExtension"] != null)
{
string allowedExtension = ConfigurationManager.AppSettings["AllowedExtension"];
} //检测目录是否存在
if (!Directory.Exists(uploadPath))
{
//创建目录
Directory.CreateDirectory(uploadPath);
} //保存上传文件
string filename = Guid.NewGuid() + Path.GetExtension(file.FileName);
uploadPath = uploadPath + filename;
uploadPath2 = uploadPath2 + filename;
file.SaveAs(uploadPath); //返回上传成功的文件路径
//下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失
context.Response.Write(uploadPath2);
}
}
}
public bool IsReusable {
get {
return false;
}
}}这是asp.net的代码
<script type="text/javascript">
$(function () {
$("#txturl_temp").uploadify({
'uploader': "/Scripts/uploadify/uploadify.swf?v=' + new Date()",
'script': "UploadHandler.ashx?v=' + new Date()",
'cancelImg': "/Scripts/uploadify/cancel.png",
'auto': true,
'multi': false,
'method': "get",
'onError': function (event, queueId, fileObj, errorObj) {
alert(errorObj.type + " Error:" + errorObj.info);
},
'onComplete': function (event, queueId, fileObj, response, data) {
$("#txturl").val(response);
//$("#Spic_spic").attr("src", response);
}
});
});
</script>这是js 代码, 在本地一切正常,挂到服务器上就不行了
以前遇到过问题 vs创建的网站项目挂到服务器上之后虚拟路径异常,你在前面加../ ../../这些试试