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

Fails to upload first file

10 Answers 41 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 30 Jul 2015, 12:25 PM

I am using Ayscupload to on a site. The upload works mostly.

 

I have an issue I can't place. Sometimes, mostly on mobile, the site will not upload the first file. I thought it might have been the progress bar ​so I removed it and I got the same result.

The first file uploads and the little yellow dot blinks but it never finishes the file. Now I can select another file while this one is blinking and that file works. When I press the "Upload" button to save the files all of them will be there except that firston If I leave the upload page and then return to it the page will now work perfectly for that session. It is only the FIRST file on the FIRST time. It is frustrating my users.... Thoughts??

 Here is the DIV that contains the control! I am using ASP.NET 3.5 and AJAX

 <div>
        <asp:Label ID="lblNoResults" runat="server" Visible="true">No Uploaded Files Yet.</asp:Label>
        <asp:Repeater ID="repResults" runat="server" Visible="false">
                <HeaderTemplate>
                    <div>Uploaded Files</div>
                </HeaderTemplate>
                <ItemTemplate>                    
                    <%#DataBinder.Eval(Container.DataItem, "Filename")%>
                    (<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString & " bytes"%>)
                    <br />
                </ItemTemplate>
            </asp:Repeater>
        <br />
        <asp:Repeater ID="repInvalidResults" runat="server" Visible="false">
                <HeaderTemplate>
                    <div>Invalid Files</div>
                </HeaderTemplate>
                <ItemTemplate>
                    File: <%#DataBinder.Eval(Container.DataItem, "Filename")%>
                    (<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%>)
                    <br />
                    Mime-type: <%#DataBinder.Eval(Container.DataItem, "ContentType").ToString()%>
                    <br /><br />
                </ItemTemplate>
            </asp:Repeater>
    </div>​

10 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 04 Aug 2015, 08:33 AM
Hi,

Unfortunately, I do not see RadAsyncUpload declaration in the div provided. Could you double-check if the posted snippet contains the RadAsyncUpload markup? I would suggest you to prepare an isolated runnable sample which could be used for the issue reproduction. And could you specify the OS version and browser type and version used to reproduce the issue?

As a side note, since you are using .NET 3.5, I would like to inform you that there is a general ASP.NET AJAX Extensions issue, concerning the new iOS 8 and OS X Safari versions. It is affecting sites using ASP.NET 3.5. Basically, the new Safari version is not properly recognized by the AJAX framework as a browser that supports partial rendering, which breaks the AJAX technology. This seems as a probable reason for the issue faced.

If you are facing the same issue, in order to fix this issue, you need to edit your browser definition files so that the latest Safari is properly recognized. You can find more detailed information about the issue as well as a workaround for it in the following stackoverflow thread.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Wayne
Top achievements
Rank 1
answered on 05 Aug 2015, 01:38 PM

Yeah Feel like a goof! There is a RadUploadAsync and I will have the code below. It is not the iOS 8 issue but thanks fro the heads up! This is mostly Android!

I'm using 2013.3.1015.40 and VB.NET with no real code behind for this section but I will post. The weird thing is it works after the first file! I will also say, not that this is the problem, we converted from the old Radupload.

 Thanks for any help! We are getting real anxious over here!

Wayne

 

DIV:

<div class="upload">
            <telerik:RadProgressManager id="rdProgress1" runat="server" />
            
            <telerik:RadAsyncUpload ID="upPics" runat="server" OverwriteExistingFiles="false" MultipleFileSelection="Automatic"
                 AllowedFileExtensions=".jpg,.gif,.jpe,.jpeg,.png" MaxFileSize="10485760" />
            <br />
            <asp:LinkButton ID="buttonSubmit" runat="server" Text="Upload" CssClass="medium button blue" />&nbsp;
            <asp:HyperLink ID="hypReturn" runat="server" CssClass="medium button blue" >Return</asp:HyperLink>
        </div>

 

CODE BEHIND:

Private Sub buttonSubmit_Click(sender As Object, e As System.EventArgs) Handles buttonSubmit.click
 
        'clear invalid
        'If upPics.InvalidFiles.Count > 0 Then
        'empty
        'upPics.InvalidFiles.Clear()
        'End If
 
        dest = dest & ListID & "\" 'create sub dir based on ListingID
        Dim tbAdp As New tblListing_ImagesTableAdapter 'declare tableadapter to us Images Table
 
        'for each file we will upload and count
        'Dim upf As UploadedFileCollection = upPics.UploadedFiles
 
        If upPics.UploadedFiles.Count > 0 Then
            For Each validfile As UploadedFile In upPics.UploadedFiles
 
                'create directory
                If Not Directory.Exists(dest) Then
                    Directory.CreateDirectory(dest)
                End If
 
                'upfile
                Dim upfile As String = ListID & "-" & validfile.GetName
 
                'lower characters
                upfile = upfile.ToLower
 
                ''we need to remove spaces, and other odd characters from file names!!!
                Dim Util As New Utility
                upfile = Util.StripNonAlphaNumericCharacters(upfile)
 
                'reduce length
                If upfile.Length > 40 Then
                    Dim ext As String = validfile.GetExtension 'upfile.Substring(upfile.LastIndexOf(".") + 1, 3).ToUpper
                    upfile = upfile.Substring(0, 40)
                    upfile = upfile & ext '"." & ext
                End If
 
                If Not File.Exists(dest & upfile) Then
                    'not sure?? threw new exception in old code
 
                    'savefile
                    validfile.SaveAs(dest & upfile)
 
                    'create DB record - if there are no other records for this listing use as main!
                    If tbAdp.CountListingImages(ListID) = 0 Then
                        tbAdp.Insert(System.Guid.NewGuid, ListID, "listimgs/" & ListID & "/" & upfile, validfile.GetExtension, True)
                    Else
                        tbAdp.Insert(System.Guid.NewGuid, ListID, "listimgs/" & ListID & "/" & upfile, validfile.GetExtension, False)
                    End If
 
                    '7/2012 - new resize by set image size
                    'now we need to open the image and resize if nec                   
                    Dim flO As String = dest & upfile
                    Dim flOt As String = dest & "tmp" & upfile
 
                    Dim imgPhoto As Image = ScaleImage(Image.FromFile(flO), 640) 'set width to 560
 
                    Dim fExt As String = validfile.GetExtension
                    If validfile.GetExtension.ToUpper = ".JPG" Or validfile.GetExtension.ToUpper = ".JPEG" Then
                        imgPhoto.Save(flOt, Imaging.ImageFormat.Jpeg)
                    ElseIf validfile.GetExtension.ToUpper = ".GIF" Then
                        imgPhoto.Save(flOt, Imaging.ImageFormat.Gif)
                    ElseIf validfile.GetExtension.ToUpper = ".PNG" Then
                        imgPhoto.Save(flOt, Imaging.ImageFormat.Png)
                    End If
 
                    imgPhoto.Dispose()
 
                    'overwrite original and delete the temp
                    File.Copy(flOt, flO, True)
                    File.Delete(flOt)
                Else
                    'file existed!!
 
                End If
            Next
            lblNoResults.Visible = False
            repResults.Visible = True
            repResults.DataSource = upPics.UploadedFiles
            repResults.DataBind()
        Else
            lblNoResults.Visible = True
            repResults.Visible = False
        End If
 
        ' If upPics.InvalidFiles.Count > 0 Then
        'repInvalidResults.Visible = True
        'repInvalidResults.DataSource = upPics.InvalidFiles
        'repInvalidResults.DataBind()
        ' End If
    End Sub

 

0
Dimitar
Telerik team
answered on 07 Aug 2015, 07:02 AM
Hi Wayne,

Unfortunately the issue is not reproducible on my side with latest Chrome browser for Android.
Could you specify the Android version used, the browser and its version? Thus, we would determine what module is used for uploading. One option to debug the file upload is to connect your mobile device to the PC and open a debug session in Chrome. Thus, you would be able to see all requests from the real device and their status when uploading - video.

In addition, could you please handle the OnClientFileUploadFailed event and the OnClientValidationFailed event and send us the error message?

Also, you may try to set the following configuration in the web.config:

<location path="Telerik.Web.UI.WebResource.axd"
    <system.web>     
        <authorization>
            <allow users="*" />     
        </authorization
    </system.web>
</location>

And last, I tested with the version you pointed and although the issue is not reproducible on my side, it may be one that has been fixed in latest version. So you may download a free latest trial and test if the issue is still reproducible with it.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Wayne
Top achievements
Rank 1
answered on 22 Aug 2015, 02:43 PM

Thank you for your response. As usually happens I got side tracked and now I am back to this issue.

It still occurs. We did try a newer version. I still have to try the change to the web.config as you mentioned.

BUT I fired up Chorme developer tools and looked at the console when uploading that first file. I get the same results as the mobile clients do, the first file fails. But iknow I see an error message!!! Maybe you can tell me what it means! 

 

 â€‹

0
Dimitar
Telerik team
answered on 24 Aug 2015, 06:38 AM
Hi,

The error means that the JSON you are trying to parse is not well formatted - it contains characters which break the parsing process. This is explained with a few examples in the parseJSON() docs. The following forum thread also deals with a similar error.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Wayne
Top achievements
Rank 1
answered on 24 Aug 2015, 12:02 PM

Thanks for the info. That's what I got.

And call me stupid but I am not calling parseJSON myself. Google Chrome points to three files; one is JQuery, the other two are Telerik Files.

That's where I am confused...how can I change that? What is actually angering it??

0
Wayne
Top achievements
Rank 1
answered on 24 Aug 2015, 02:46 PM
Also if you upload a second file it works or refresh the page!!
0
Wayne
Top achievements
Rank 1
answered on 24 Aug 2015, 03:13 PM

It also only happens on the mobile version of the site. Whether or not its loaded on the desktop. 

First file only! I'm stumped i looked through my html line by line on both the page and the master page. No Errors.

I fixed some CSS errors thinking that might help! NOPE! No error message in the on client error handles...at least not that I could produce. It may be interesting the file that fails never makes it to the temp upload dir.

Where do i want to put the location tag in the web.config?? never done that before...worth a shot.

 

0
Wayne
Top achievements
Rank 1
answered on 24 Aug 2015, 05:27 PM

I tried isolating the control for fun. Same result.

The page below has no code in the code behind and has only the following HTML.

 At this point it seems like a problem with the control itself or some config problem.

 Any ideas?

 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="upTestAug.aspx.vb" Inherits="AFOHAB.upTestAug" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
 
<html>
<head runat="server">
    <title>test upload no code</title>
</head>
<body>
    <form id="form1" runat="server">
    <cc1:ToolkitScriptManager id="ToolkitScriptManager1" runat="server" />
 
    <div>
        <telerik:RadProgressManager id="rdProgress1" runat="server" />
                   
        <telerik:RadAsyncUpload ID="upPics" runat="server" OverwriteExistingFiles="false" MultipleFileSelection="Automatic" UseApplicationPoolImpersonation="true"
                 AllowedFileExtensions=".jpg,.gif,.jpe,.jpeg,.png" MaxFileSize="10485760" />
 
    </div>
 
    </form>
</body>
</html>

0
Dimitar
Telerik team
answered on 25 Aug 2015, 01:51 PM
Hi,

There is a known compatibility issue with AjaxControlToolkit and it is the most likely cause for the issue. You may find more information about it and how to resolve it in the Telerik UI for ASP.NET AJAX and AJAX Control Toolkit help article.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
AsyncUpload
Asked by
Wayne
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Wayne
Top achievements
Rank 1
Share this question
or