当前位置:编程学习 > C#/ASP.NET >>

关于Uploadify上传至指定目录的问题

'uploader': 'UploadHandler.ashx?目录='
其中 目录=由页面传值过来,怎么获取由页面传来的值? --------------------编程问答--------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;  
using System.Net;
using System.Web;
using System.Web.Services;
using System.Text;
using MoMoBlogItem.Models;
using System.Web.UI.WebControls;

namespace JQueryUploadDemo
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    public class UploadHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset = "utf-8";
            HttpPostedFile file = context.Request.Files["Filedata"];
            string uploadPath = context.Request["folder"] 
         }
           
     }
}

之前写的, 你试试!应该没问题 --------------------编程问答-------------------- Request.QueryString["值"].ToString() --------------------编程问答-------------------- 非常感谢前面二位,其实也不行的。但解决了。
先在代码文件中:
    Public strfolder As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        strfolder = Request.QueryString("lsh")
    End Sub

再在页面文件中,改为:'uploader': 'UploadHandler.ashx?lsh=<%=strfolder%>'  , --------------------编程问答-------------------- ["值"]   用中括号倒没试过。 --------------------编程问答--------------------
引用 3 楼 sjxwb 的回复:
非常感谢前面二位,其实也不行的。但解决了。
先在代码文件中:
    Public strfolder As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        strfolder =……


目录你不需要传。 默认就是post  你干嘛要自己还去指定个目录。

那你做用这个插件的意义何在 --------------------编程问答-------------------- 一个项目建一个目录,然后在这个目录中上传该项目的图片资料。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,