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

RadUpload and RadProgress last file does not appear to finish.

8 Answers 139 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 05 Sep 2012, 07:58 PM
Ok,

Been playing with Telerik for a little while, really like it, thinking about purchase but I hit a wall.

I have a content page that has NO update panels just the rad controls and a couple of datalists to display the results...works on my machine and on the server but on the server when we upload a large amount of files it uploads just fine BUT the progress control never finishes on the users screen but the upload does work...I cannot replicate on my dev machine so i cant figure the problem...The control works perfectly on two or three files and its not specific on how many files it takes to fail...

Does this set of controls have issues on GoDaddy?

Code Below,

Thanks!
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="width:1200px;margin:0 auto;">
         
        <h1>Upload Listing Images</h1>
        <asp:HyperLink ID="hypReturn" runat="server">Return to Edit Listing Page</asp:HyperLink>
        <br /><br />
 
        <div style="float:left;width:500px;margin:0 50px 0 50px;">
            <telerik:RadProgressManager id="rdProgress1" runat="server" />
 
            <telerik:RadProgressArea ID="pgBar1" runat="server" Language="" />
            <telerik:RadUpload ID="upPics" runat="server" OverwriteExistingFiles="false"
                 AllowedFileExtensions=".jpg,.jpeg,.gif,.jpe" MaxFileSize="5242880" InitialFileInputsCount="5" />
            <br />
            <asp:Button ID="buttonSubmit" runat="server" Text="Upload All" CssClass="RadUploadSubmit"    />
        </div>
 
        <div style="float:left;width:500px;font-size:12px;">
            <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>      
     
     
    </div>   
 
    <div style="clear:both;"></div>
     
</asp:Content>


Imports System
Imports System.Data
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.IO
Imports Telerik.Web.UI
Imports AFOHAB_DAL.AFOHABTableAdapters
 
Public Class upimage
    Inherits System.Web.UI.Page
 
#Region "Globals"
    'destination
    Dim dest As String = Server.MapPath("~/listimgs/")
    Dim ListID As String
#End Region
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'get listing id otherwise redirect
        ListID = Request.QueryString("ListingID")
 
        If ListID Is Nothing Or ListID = "" Then
            'no data
            Response.Redirect("~/admin/admin.aspx")
        Else
            'continue
 
            'assign return navigate url
            hypReturn.NavigateUrl = "~/admin/listingedit.aspx?id=" & ListID
        End If
    End Sub
 
    Private Sub buttonSubmit_Click(sender As Object, e As System.EventArgs) Handles buttonSubmit.Click
 
        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
 
                If File.Exists(dest & upfile) Then
                    'not sure?? threw new exception in old code
                End If
 
                '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 = upfile.Substring(upfile.LastIndexOf(".") + 1, 3).ToUpper
                    upfile = upfile.Substring(0, 40)
                    upfile = upfile & "." & ext
                End If
 
                '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
                'resize
                'now we need to open the image and resize if nec
                'Dim flOrig As New FileInfo(dest & upfile)
                'Dim flSize As Integer = flOrig.Length / 1024
                Dim flO As String = dest & upfile
                Dim flOt As String = dest & "tmp" & upfile
                'flUpload.Dispose()
 
                'If flSize > 100 Then
                'greater than 100KB then resize
                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)
                End If
 
                'imgPhoto.Save(flOt, Imaging.ImageFormat.Jpeg)
                imgPhoto.Dispose()
 
                'overwrite original and delete the temp
                File.Copy(flOt, flO, True)
                File.Delete(flOt)
                '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
 
    Private Shared Function ScaleByPercent(ByVal imgPhoto As Image, ByVal Percent As Integer) As Image
        Dim nPercent As Single = (CSng(Percent) / 100)
 
        Dim sourceWidth As Integer = imgPhoto.Width
        Dim sourceHeight As Integer = imgPhoto.Height
        Dim sourceX As Integer = 0
        Dim sourceY As Integer = 0
 
        Dim destX As Integer = 0
        Dim destY As Integer = 0
        Dim destWidth As Integer = CInt((sourceWidth * nPercent))
        Dim destHeight As Integer = CInt((sourceHeight * nPercent))
 
        Dim bmPhoto As New Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb)
        bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution)
 
        Dim grPhoto As Graphics = Graphics.FromImage(bmPhoto)
        grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic
 
        grPhoto.DrawImage(imgPhoto, New Rectangle(destX, destY, destWidth, destHeight), New Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel)
 
        grPhoto.Dispose()
        imgPhoto.Dispose()
        Return bmPhoto
    End Function
 
    Private Shared Function ScaleImage(imgPhoto As Image, intNewWidth As Integer) As Image
 
        Dim sourceWidth As Integer = imgPhoto.Width
        Dim sourceHeight As Integer = imgPhoto.Height
        Dim sourceX As Integer = 0
        Dim sourceY As Integer = 0
 
        Dim newHeightPercent As Decimal = intNewWidth / sourceWidth
 
        If newHeightPercent > 1 Then
            'the image is already too small so jsut return the original image
            Return imgPhoto
        Else
            'the image IS too big so resize
            Dim destX As Integer = 0
            Dim destY As Integer = 0
            Dim destWidth As Integer = intNewWidth
            Dim destHeight As Integer = newHeightPercent * sourceHeight
 
            Dim bmPhoto As New Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb)
            bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution)
 
            Dim grPhoto As Graphics = Graphics.FromImage(bmPhoto)
            grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic
 
            grPhoto.DrawImage(imgPhoto, New Rectangle(destX, destY, destWidth, destHeight), New Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel)
 
            grPhoto.Dispose()
            imgPhoto.Dispose()
            Return bmPhoto
        End If
    End Function
 
End Class

8 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Sep 2012, 12:31 PM
Hello Wayne,

 
Please review the RadProgressArea Configuration help topic in case you have missed some of them.

As for the GoDaddy question currently we are not aware of any unusual issues with it.

Hope this will be helpful.

Greetings,
Plamen
the Telerik team
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 their blog feed now.
0
Waseem
Top achievements
Rank 1
answered on 19 Oct 2012, 11:46 PM
Hi I am trying to upload File by using RadUpload. Its work on local pc as well as on Server. But on our one client pc (Window 7). it cause error. I am 100 % sure about my code. Its working great. Is there any permission or what is this?

Could not find a part of the path 'D:\Testing\Test.pdf'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.

[DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +216
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +2481
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +229
0
Plamen
Telerik team
answered on 24 Oct 2012, 02:27 PM
Hello Waseem,

 
You can check the security of both Temporary/Target folders used if they allow reading and writing files in them. The path can be passed wrongly if you are using proxy server as well. 

Hope this will be helpful.

All the best,
Plamen
the Telerik team
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 their blog feed now.
0
Waseem
Top achievements
Rank 1
answered on 24 Oct 2012, 03:53 PM
My Target Folder is server path. Its has full access of read and write (to upload a file). because i am able to upload a file as well as other clients on it as well as i am using proxy server to upload file. its work ok.

But one of our client not able to upload a file.
How can i able to get this error locally in my Visual studio? So i can explain to my client that you have some permission issue on your computer.

If i am succeed to get this error locally. i can explain to them.
Is there any way to get this error locally? and some solution to solve it.

and what is temporary folder purpose?
Thanks Plamen.
0
Plamen
Telerik team
answered on 29 Oct 2012, 11:11 AM
Hello Waseem,

You can ask him to explain the steps to reproduce the error and clarify the exact browser used and  try to reproduce is locally accordingly. 

You can refer to this help topic where function of the Temporary folder is explained.

Greetings,
Plamen
the Telerik team
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 their blog feed now.
0
Waseem
Top achievements
Rank 1
answered on 14 Nov 2012, 04:51 PM
I am very worry about this issue?
Path is 100% correct and has full permission. Its work locally as well as on server. but one of our client get this error. i have no idea.
Can you help me in this? Please see latest images.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.

[DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +216
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +2481
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +229
0
Plamen
Telerik team
answered on 16 Nov 2012, 07:30 AM
Hello Waseem,

 
We are not aware of such error to be caused by the default behavior of RadUpload and we have not been reported as well -so it  should be some how caused by your additional custom code and functionality. I will recommend you to refer to this forum thread where general solutions for this issue have been provided. 

Kind regards,
Plamen
the Telerik team
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 their blog feed now.
0
Waseem
Top achievements
Rank 1
answered on 24 Nov 2012, 02:24 PM
Hello Plamen
I got the solution of this issue, its only arise in IE on few particular computer. After uploading it again and again and checking on client computer. i figure out this.

This problem is arise due to this: When we getting UploadedFile  name [  file.FileName.ToString() ]
So need to use this
file.GetNameWithoutExtension() + file.GetExtension();
instead of file.FileName.ToString();

string targetFolder = System.Web.HttpContext.Current.Server.MapPath(@"~/TestUpload");
string file1 = file.GetNameWithoutExtension() + file.GetExtension();
string targetFileName = System.IO.Path.Combine(targetFolder, file1);

Thanks,
Muhammad Waseem
Tags
Upload (Obsolete)
Asked by
Wayne
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Waseem
Top achievements
Rank 1
Share this question
or