0
uplodifiy를 사용하여 사진을 업로드하고 있습니다. 여기 내 코드는 아래에 있습니다. 그러나 Upload.ashx 핸들러 안에 이 있습니다. 제출 된 값 (Id 및 foo 값)을 얻습니다. 즉, null 값을 반환합니다. 어떻게이 문제를 해결할 수 있습니까? 감사합니다. 나는이ashx 파일 내에서 클라이언트 측 값을 얻습니다.
$(document).ready(function() {
var id = "55";
var theString = "asdf";
$("#<%=FileUpload1.ClientID%>").uploadify({
'uploader': 'Upload.ashx',
'swf': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': 'images/cancel.png',
'folder': 'upload',
'multi': true,
'buttonText': 'RESIM SEC',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'auto': false,
'scriptData': { 'id': id, 'foo': theString}
,onAllComplete: function (event, data) {
}
});
});
이처럼 내 ASHX 파일과 같은 코드를 가지고;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Expires = -1;
try
{
//I tryed both way to get values both both return null values.
string pwd1 = context.Request["Id"];
string pwd2 = context.Request.Form["Foo"];
HttpPostedFile postedFile = context.Request.Files["Filedata"];
string id = context.Request["id"];
string savepath = "";
string tempPath = "";
tempPath = context.Request["folder"];
//If you prefer to use web.config for folder path, uncomment below line:
//tempPath = System.Configuration.ConfigurationManager.AppSettings["FolderPath"];
savepath = context.Server.MapPath(tempPath);
string filename = postedFile.FileName;
if (!Directory.Exists(savepath))
Directory.CreateDirectory(savepath);
string ext = System.IO.Path.GetExtension(filename);
string resimGuid = Guid.NewGuid().ToString();
..........
..........
perfecct, 정말 고마워요. – sakir