Застрял в этой части в течение нескольких дней, но я все еще не мог передать строку запроса универсальному обработчику.
Мой код выглядит следующим образом:
1-й: строка запроса передается вUpload.aspx.и я получаю его в разделе загрузки страницы:
Мой Upload.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
int userId = Convert.ToInt32(Request.QueryString["userid"]);
int upload = Convert.ToInt32(Request.QueryString["upload"]);
int childId = Convert.ToInt32(Request.QueryString["childid"]);
}
Мой Upload.aspx
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': 'uploadify/cancel.png',
'auto': true,
'multi': true,
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'queueSizeLimit': 90,
'sizeLimit': 4000000,
'buttonText': 'Choose Images',
'folder': '/uploads',
'onAllComplete': function(event, queueID, fileObj, response, data) {
}
});
});
Мой upload.ashx
public void ProcessRequest(HttpContext context)
{
try
{
HttpPostedFile file = context.Request.Files["Filedata"];
Global.myDBManager.ConnectionString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
Global.myDBManager.DataProviderType = DBMgr.DataProvider.MySql;
Global.myDBManager.Connect();
int id = 1 + Convert.ToInt32(Global.myDBManager.ExecuteScalar("Select id from picture order by picture_id desc limit 1"));
Global.myDBManager.ExecuteScalar("Insert into image(picture_id,user_id) VALUE('" + id + "', '" + userId + "')");
file.SaveAs("C:\\" + id.ToString() + file.FileName);
context.Response.Write("1");
}
catch (Exception ex)
{
context.Response.Write("0");
}
}
как передать запрос в upload.ashx?где userId - это запрос, который я пытаюсь передать.
Заранее спасибо!