日期:2014-05-20  浏览次数:20397 次

在线等待.net多图片上传问题,请教高手。急
前台js:
<script   language= "javascript "   type= "text/javascript ">
function   AddPhoto()
{

            var   index   =   Math.floor(Math.random()   *   100000000);  

                var   str= ' <input   type=\ "file\ "   name=\ "file\ "   id=\ " '+index+ '\ "   style=\ "position:absolute;filter:alpha(opacity=0);\ "   size=\ "1\ "> '
                document.getElementById( 'aaa ').insertAdjacentHTML( "beforeEnd ",str);  
        document.getElementById(index).click();
       
        var   PhotoURL= " ";
        PhotoURL   =   document.getElementById(index).value;
        if(PhotoURL   ==   " ")
        {
                alert( "请选择要上传的图片! ");
                        return   false;
        }
        else
        {
                var   str= ' <img   id\ "kkk\ "   src=\ " '+PhotoURL+ '\ "   width=\ "120\ "   height=\ "120\ "   /> '
                        document.getElementById( 'pic_space_main ').insertAdjacentHTML( "beforeEnd ",str);
        }
}
前台显示代码:
<td   colspan= "2 "   align= "center "> <div   id= "pic_space_main "  
            style= "OVERFLOW-X:   hidden;   WIDTH:   500px;   HEIGHT:   350px "   align= "left "  
            valign= "top "> </div> </td>
<input   type= "button "     value= "浏览本地图片 "   class= "fg_btn "   onclick= "AddPhoto(); "   size= " "> </td>
                                <td   width= "152 "   align= "center "   style= "height:   24px "> <asp:Button   ID= "Upload "   runat= "server "   class= "fg_btn "   Text= "确认上传图片 "   OnClick= "Button1_Click "   /> </td>

现在的问题是我上传的时候   保存不了js生成的File控件中的图片地址。
查了好多帖子都没解决

------解决方案--------------------
http://dotnet.aspx.cc/ShowDetail.aspx?id=58EA3515-36F2-4FD9-AC89-EAF49F59816C
------解决方案--------------------
<%@ Page language= "c# " Codebehind= "MultiAttchments.aspx.cs " AutoEventWireup= "false " Inherits= "WebApplication3.MultiAttchments " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<script>
function AddAttachments()
{
document.getElementById( 'attach ').innerText = "继续添加附件 ";