This is a migrated thread and some comments may be shown as answers.

500 Error on upload

3 Answers 577 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jeff Wickersham
Top achievements
Rank 1
Jeff Wickersham asked on 21 Jun 2013, 09:22 PM
I have a simple upload page that runs fine locally on my dev box but throws a nasty 500 error on the server, I have set the upload folder permissions to allow full control to everyone--any ideas?

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">

        <link href="Upload.css" rel="Stylesheet" type="text/css" />
        <script type="text/javascript">
            //<![CDATA[
            function validationFailed(sender, eventArgs) {
                $(".ErrorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
            }
            //]]>
        </script>

        <div class="MainWrap">
            <div class="TopWrap">
                <div class="Holder">
                    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions=".txt,.csv" TargetFolder="c:\Files\Import"
                        OnFileUploaded="RadAsyncUpload1_FileUploaded" OnClientValidationFailed="validationFailed">
                    </telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="BtnSubmit" Text="Submit" Skin="Metro">
                        <Icon SecondaryIconLeft="5" SecondaryIconTop="3" SecondaryIconUrl="images/gear.png" />
                    </telerik:RadButton>
                    <p>
                        Select File To Upload (formats accepted .csv,.txt, only)
                    </p>

                    <div class="ErrorHolder">
                    </div>
                </div>
                <div class="Holder Right">
                    <asp:Panel runat="server" ID="ResultsPanel" Visible="false">
                        <asp:Panel ID="ValidFiles" Visible="false" runat="server">
                            <p>
                                <asp:Label runat="server" ID="lblFileUpload" Font-Bold="True" /><br/>
                                <asp:Label runat="server" ID="lblBatchId"/><br/>
                                 <asp:Label runat="server" ID="lblProcessTime"/>
                            </p>
                            <p>
                                <telerik:RadButton ID="BtnImport" runat="server" Text="Import" OnClick="BtnImport_Click" Skin="Metro" Visible="false">
                                    <Icon SecondaryIconLeft="5" SecondaryIconTop="3" SecondaryIconUrl="images/find.png" />
                                </telerik:RadButton>
                            </p>
                            <br />
                            <asp:Label ID="lblMessage" runat="server" Visible="false" />
                        </asp:Panel>
                        <asp:Panel ID="InvalidFiles" Visible="false" runat="server">
                            <p>
                                <strong>The following files were not saved due to exceeding the maximum total size:</strong>
                            </p>
                        </asp:Panel>
                    </asp:Panel>
                </div>
                <div class="BottomWrap">
                </div>
            </div>
        </div>
    </telerik:RadAjaxPanel>
 public void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        Label fileName = new Label();
        fileName.Text = e.File.FileName;
        Session["FileName"] = e.File.FileName;

        if (totalBytes < MaxTotalBytes)
        {
            // Total bytes limit has not been reached, accept the file
            e.IsValid = true;
            totalBytes += e.File.ContentLength;
        }
        else
        {
            // Limit reached, discard the file
            e.IsValid = false;
        }

        if (e.IsValid)
        {
            ValidFiles.Visible = true;
            ValidFiles.Controls.Add(fileName);
            BtnImport.Visible = true;
            lblMessage.Visible = true;
            lblFileUpload.Text = @"File Upload Was Successful";

        }
        else
        {
            InvalidFiles.Visible = true;
            InvalidFiles.Controls.Add(fileName);
        }
    }

3 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 26 Jun 2013, 02:37 PM
Hi Jeff,

The Temporary folder also must have write permissions. If you are uploading larger files be sure that you configure your IIS correctly, as different IIS versions needs different configuration.

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Taras
Top achievements
Rank 1
answered on 27 Jun 2013, 08:51 PM
There is my very simple code. it is usercontrol in sharepoint. I'he given full permission to all users, iis apppool, network servise  for folder App_Data. But inside App_Data i have file "RadUploadTestFile" and its size is zero.
When i'm trying to upload file, i have "HTTP error code is 500".(I've attached image).
What's wrong with it?

<telerik:RadAsyncUpload ID="radAsyncUpload" runat="server" EnableInlineProgress="true" OnFileUploaded="RadAsyncUpload1_FileUploaded"
             MaxFileInputsCount="1" OnClientFileUploaded="onClientFileUploaded" OnClientFileUploadFailed="onClientFileUploadFailed" OnClientFileUploadRemoved="onClientFileUploadRemoved"
             PostbackTriggers="radUpload" />
 
        <telerik:RadButton ID="radUpload" runat="server" Text="Upload" Enabled="false" CausesValidation="false" />
 
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable = function () { return false; };
                 
                function onClientFileUploadFailed(sender, args) {
                    args.set_handled(true);
                    alert(args.get_message());
                }
                 
 
                function onClientFileUploaded(sender, args) {
                    var radUpload = $find("<%=radUpload.ClientID %>");
 
                    radUpload.set_enabled(true);
                }
                function onClientFileUploadRemoved(sender, args) {
                    var radUpload = $find("<%=radUpload.ClientID %>");
 
                    radUpload.set_enabled(false);
                }
            </script>
        </telerik:RadScriptBlock>
0
Hristo Valyavicharski
Telerik team
answered on 02 Jul 2013, 03:05 PM
Hi Taras,

Check if the RadAsyncUpload handler is registered correctly. For additional information please take a look at this article.

Also you may try to open:

http://localhost:64992/Telerik.web.ui.webresource.axd?type=rau

if it is registered you will see:

{ "message" : "RadAsyncUpload handler is registered successfully, however, it may not be accessed directly." }

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AsyncUpload
Asked by
Jeff Wickersham
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Taras
Top achievements
Rank 1
Share this question
or