0

我正在使用 DLLImageGallery控件 FreeTextbox将图像上传到服务器。我面临的问题是当我单击上传按钮时,会显示此错误页面 在此处输入图像描述 我检查 chrome 的控制台,我收到以下错误

在此处输入图像描述

这是我的 ftb.imagegallery.aspx 的 aspx 代码

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox, Version=3.3.1.12354, Culture=neutral, PublicKeyToken=5962a4e684a48b87" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <FTB:ImageGallery ID="ImageGallery1"
                AllowImageDelete="true" JavaScriptLocation="InternalResource" UtilityImagesLocation="InternalResource"
                AllowImageUpload="true" AllowDirectoryCreate="true" AllowDirectoryDelete="true" runat="Server"  />
        </div>

    </form>
</body>
</html>
4

1 回答 1

0

我无法解决这个问题,或者我设法通过使用 A FileUploadControll 手动上传图像来解决这个问题。这是我为将来遇到此问题的任何人提供的代码。

1.ftb.imagegallery.aspx

 <form id="form1" runat="server">
        <div>
            <FTB:ImageGallery ID="ImageGallery1"
                AllowImageDelete="true" JavaScriptLocation="InternalResource" UtilityImagesLocation="InternalResource"
                AllowImageUpload="False" AllowDirectoryCreate="true" AllowDirectoryDelete="true" runat="Server" />
        </div>
        <div class="col-md-6">
            <div class="col-md-8">
                <asp:FileUpload runat="server" ID="fileupload1" CssClass="form-control" AllowMultiple="False" />
            </div>
            <div class="col-md-4">
                <asp:Button runat="server" Text="UPLOAD" CssClass="btn btn-success" ID="btnsumbit" OnClick="btnsumbit_OnClick" />
            </div>
        </div>
    </form>

2.后面的代码

 protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnsumbit_OnClick(object sender, EventArgs e)
    {
        if (fileupload1.HasFile)
        {
            foreach (HttpPostedFile file in fileupload1.PostedFiles)
            {
                string fileName = Path.GetFileName(fileupload1.PostedFile.FileName);
                fileupload1.PostedFile.SaveAs(Server.MapPath("~/Images/") + fileName);
                Response.Redirect(Request.Url.AbsoluteUri);
            }  
        }
    }
于 2016-06-06T06:02:55.060 回答