AjaxFileUpload键“上传”失败上传、AjaxFileUpload

2023-09-11 01:32:19 作者:囘忆↗狠渼

我已经做了相当多的搜索,并尝试了许多不同的选择。还没有看到任何其他人谁一直有类似的问题。

I have done quite a bit of searching, and tried many different options. Haven't even seen any other person who has been having a similar problem.

我有以下code放置到我的网页和元素精反应在页面上。为'ToolKitScriptManager我试图既经常以及下文所示。无论是工作。

I have the the following code placed into my page and the element reacts fine on the page. For the 'ToolKitScriptManager I have tried both the regular as well as the one shown below. Neither work.

        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
        <asp:AjaxFileUpload ID="inpFileUpload" runat="server" OnUploadComplete="inpFileUpload_UploadComplete" MaximumNumberOfFiles="3" AllowedFileTypes="jpg,jpeg,doc,png" />

我有以下的背景code为元素

I have the following background code for the element

    protected void inpFileUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
        string path = @"\\NetworkPath\UploadedFiles\" + e.FileName;
        inpFileUpload.SaveAs(path);
    }

但是它给了我没有错误,或者消息,指出任何可能是想错了。我跟每一个教程中,我可以找到这个元素上并没有已经能够解决这个问题。

However it gives me no error, or message stating anything that could be going wrong. I have followed every tutorial I can find on this element and none have been able to fix this issue.

我preSS浏览查找文件,选择一个/多个,一切似乎做得很好,该文件显示在上传列表。

I press browse to find a file, select one/more than one and everything appears to be doing fine, the files appear in the upload list.

然而,当我点击了带有这种AjaxFileUpload元素没有任何反应上传按钮。有时你可以看到红色的上传按钮,但马上又回到了上传蓝色的风格了。不上传选择的文件,或者从我可以告诉它没有做任何事情,当按钮$ P $不是很快改变按钮的外观pssed等。

However when I click the 'Upload' button that comes with this AjaxFileUpload element nothing happens. At times you can see red on the Upload button but it immediately goes back to the 'Upload' blue style again. Does not upload the files selected, or from what I can tell it isn't doing anything when the button is pressed other than very quickly changing the look of the button.

不知道我做错了,或者如果我失去了一些东西。

Not sure what I am doing wrong, or if I am missing something..

更新

由于马修的帮助下得知有一个JavaScript错误控制台,当pressing上传按钮,返回未捕获的异常:无法开始上传

Thanks to the help of Matthew learned there was a javascript error console which when pressing the 'Upload' button it returns "Uncaught Exception: Failed to starting upload"

推荐答案

看起来像我解决了它。它是与我的Request.QueryString [身份证]当我加载页面。出于某种原因,它重新加载页面,并且失去了查询字符串返回空值这反过来又导致一切搞乱了文件上传。

Looks like I solved it. It has something to do with my Request.QueryString["id"] when I load the page. For some reason it reloads the page and loses that QueryString which returns null which in turn causes everything to mess up for the file upload.

当我指定一个硬盘codeD变量作为查询字符串[ID]上传工作正常。然而,当离开正常的得到它失败的查询字符串,并返回null。

When I assign a hard coded variable as the QueryString["id"] the upload works fine. However when left normal to get the QueryString it fails and returns null.

我还没有解决,为什么它被抓空,而不是我的身份证号码,但我的ID号和上传硬编码工作pretty的多确认这是问题。

I have not solved out why it is grabbing null and not my id number but me hard coding in the id number and the upload works pretty much confirms that this is the issue.

如果任何人都可能有信息,为什么我的查询字符串返回的文件上传,将是巨大空!哈哈

If anyone might have information as to why my QueryString returns null on file upload that would be great! haha

答案

所以做了一些研究,显然这是AjaxToolKit一个问题,而不是什么,我一直在做。我下载的链接断开的https://ajaxcontroltoolkit.$c$cplex.com/workitem/27149 和用于更新JavaScript的code变化的DLL和一切开始工作的罚款。

So did some research, apparently this is a problem with AjaxToolKit and not anything I have been doing. I downloaded the links off https://ajaxcontroltoolkit.codeplex.com/workitem/27149 and used the DLLs with the updated javascript code changes and everything started working fine.

这是我发现的文件上传不解析URL中的已放置查询字符串,因此将它们替换它需要什么,并继续与出许多错误。

From what I found the fileupload does not parse for already placed querystrings in the URL so it replaces them with what it needs and continues on with out many errors.

让我们期待他们得到它的更新版本了。

Lets hope they get an updated version of it out.