PDA

View Full Version : آپلودر فایل با jquery و ajax و مشکل با iis7



majid_quds
سه شنبه 19 شهریور 1392, 20:04 عصر
با سلام
یک آپلودر فایل نوشتیم که داخل لوکال کار میکنه
ولی وقتی انتقال میدیم به iis7 همه کارا انجام میشه ولی فایل آپلود نمیشه
آیا تنظیمات خاصی برای iis هست یا نه؟
توضیح بیشتر اینکه در لوکال هر مسیری بدی درسته ولی در iis نه
عاجزانه تقاضای کمک دارم

اینم کدها:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace test_er
{
public class FileUploadHandler: IHttpHandler
{
#region IHttpHandler Members

public bool IsReusable
{
get { return false; }
}

public void ProcessRequest(HttpContext context)
{
try
{
//Uploaded File Deletion
if (context.Request.QueryString.Count > 0)
{
string filePath = @"C:\test\" + context.Request.QueryString[0].ToString();
if(File.Exists(filePath))
File.Delete(filePath);
}
//File Upload
else
{
string fileName = Path.GetFileName(context.Request.Files[0].FileName);
string location = @"C:\test\" +fileName;
context.Request.Files[0].SaveAs(location);
//HttpContext.Current.Server.MapPath("share") + "\\" + fileName;
}
}
catch
{

}
}

#endregion
}
}

majid_quds
سه شنبه 19 شهریور 1392, 21:18 عصر
اینم کدها:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace test_er
{
public class FileUploadHandler: IHttpHandler
{
#region IHttpHandler Members

public bool IsReusable
{
get { return false; }
}

public void ProcessRequest(HttpContext context)
{
try
{
//Uploaded File Deletion
if (context.Request.QueryString.Count > 0)
{
string filePath = @"C:\test\" + context.Request.QueryString[0].ToString();
if(File.Exists(filePath))
File.Delete(filePath);
}
//File Upload
else
{
string fileName = Path.GetFileName(context.Request.Files[0].FileName);
string location = @"C:\test\" +fileName;
context.Request.Files[0].SaveAs(location);
//HttpContext.Current.Server.MapPath("share") + "\\" + fileName;
}
}
catch
{

}
}

#endregion
}
}



110443


کمک کنید
خواهش می کنم