Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having problem with the AjaxFileUpload that enables dragging and dropping of images. Upon clicking "Upload" the file does not upload and shows a red "error" message by the side of the file.

Would greatly appreciate, if someone can provide the solution to it.
Below is a snippet of my code.

.aspx page
ASP.NET
<ajaxToolkit:AjaxFileUpload
        id="ajaxUpload1"
         önUploadComplete="ajaxUpload1_OnUploadComplete"
        ThrobberID="MyThrobber"
        MaximumNumberOfFiles="1"
        AllowedFileTypes="jpg,jpeg,gif,png"
         runat="server"  />

        <asp:Image
            id="MyThrobber"
            ImageUrl="~/images/ajax-loader.gif"
            Style="display:None"
            runat="server" />

.cs
C#
protected void ajaxUpload1_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
    // Generate file path
    string filePath = "~/images/" + e.FileName;

    // Save upload file to the file system
    ajaxUpload1.SaveAs(MapPath(filePath));
}
Posted
v2
Comments
What is that Error message?
Jerrell77 13-Jun-13 10:58am    
Hello, actually it just shows the upload progress as 0% and the word "error" just appears beside the file that i was trying to upload. this is the AjaxFileUpload that i used from the Ajax toolbox
Can you check on Console window of FireBug in Firefox, if you have any errors or not?
Jerrell77 13-Jun-13 11:29am    
Hi, does anyone have a solution to this??
Calvijn 13-Jun-13 19:11pm    
in => önUploadComplete="ajaxUpload1_OnUploadComplete"
is the char ö a typo in your origin code or just happened through copy & paste ?

1 solution

Add the following to your web.config:

XML
<system.webServer>
  <handlers>
    <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />
  </handlers>
</system.webServer>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900