RadAsync Upload temporary filename

4 posts, 1 answers
  1. Lighthouse Developer
    Lighthouse Developer avatar
    34 posts
    Member since:
    Feb 2010

    Posted 05 Jul 2010 Link to this post

    Hi,
    Ι know that it has been asked many times,but is there a workaround to get the  the temporary file's name(not the filepath,only the filename) ?
    I want to check the dimensions of the uploaded image after it has been uploaded.
    Unfortunately the upload with full postback is not an option,because in my scenario the're mutliple radAsyncUpload controls in the same page.
  2. mastermehdi
    mastermehdi avatar
    39 posts
    Member since:
    Apr 2010

    Posted 05 Jul 2010 Link to this post

    use somthing like this ror an asp:CustomValidator

        protected void csvView0DimensionBannerFile_ServerValidate(object sender, ServerValidateEventArgs args)
        {
            if (rauView0BannerFile.UploadedFiles.Count == 1 && ddlView0Dimensions.SelectedValue != "0")
            {
                if (rauView0BannerFile.UploadedFiles[0].ContentType.ToLower() == "image/gif" ||
                    rauView0BannerFile.UploadedFiles[0].ContentType.ToLower() == "image/jpeg" ||
                    rauView0BannerFile.UploadedFiles[0].ContentType.ToLower() == "image/png")
                {
                    using (Stream fileStream = rauView0BannerFile.UploadedFiles[0].InputStream)
                    {
                        System.Drawing.Image image = System.Drawing.Image.FromStream(fileStream);
                        if (image.Width.ToString() == 800 && image.Height.ToString() == 600)
                        {
                            args.IsValid = true;
                        }
                        else
                        {
                            args.IsValid = false;
                        }
                    }
                }
            }
        } 

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lighthouse Developer
    Lighthouse Developer avatar
    34 posts
    Member since:
    Feb 2010

    Posted 05 Jul 2010 Link to this post

    Thank you very much for your help Mehdi,
    but if Im right,the server validate method of the asp.validator is executed after page postback.
            As I mention in my first post,the full page postback is not an option in my scenario,because I want to have multiple RadAsyncUpload controls in my page.The postback caused from one RadAsyncUpload will "change" the rest of the upload controls and I want to avoid such behavior.

    Thank you very much again
  5. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 06 Jul 2010 Link to this post

    Hello Lighthouse Developer,

    The temporary filename is not available on the client due to security reasons. However, we have some good news from you. Starting from the upcoming Q2 release, one will be able to do such kind of validation at the handler and then return some custom result to the client (containing the result of the validation, for example). You can find sample demo demonstrating the approach here.

    Sincerely yours,
    Genady Sergeev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top