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

swfobject.embedSWF 求助

最近想做一个图片批量上传的功能,感觉swfobject.embedSWF 的功能还是不错的,代码如下:

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
   window.onload = function()
   {
      var params = {
      uploadServerUrl : "upabc.ashx",          //上传响应页面(必须设置)
      jsFunction : "upload", //上传成功后回调JS
      filter : "*.jpg;*.png" //上传文件类型限制
      }
 swfobject.embedSWF("uploadImage.swf", "myContent", "600", "500", "10.0.0", "expressInstall.swf", params);
   }
   
   function upload()
   {
alert("上传成功!");
   }
</script>



upabc.ashx

using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace DtCms.Web.FlashUpload
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class upabc : IHttpHandler
    {
        public void ProcessRequest(HttpContext context) 
        {
            HttpFileCollection files = context.Request.Files;
            if (files.Count == 0)
            {
                context.Response.Write("请勿直接访问本文件");
                context.Response.End();
            }

            string path = context.Server.MapPath("ImageList");

            HttpPostedFile file = files[0];

            if (file != null && file.ContentLength > 0)
            {
                // flash 会自动发送文件名到 Request.Form["fileName"]
                string savePath = path + "/" + context.Request.Form["fileName"];
                file.SaveAs(savePath);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
;
            }
        }
    }
}


问题:js文件放在一个html中,点击上传后,由upabc.ashx处理,

 请问如何Html页面中如何得到文件的上传路径? --------------------编程问答-------------------- 一般好像上传控件里都有设置的吧?在upload里面,或者根目录? --------------------编程问答-------------------- 楼主 我现在也在用这个批量传图片的,现在我这有一个问题,如何获取URL上的多个参数?速回。。。。  谢谢
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,