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

ie not support kendo upload

2 Answers 132 Views
Upload
This is a migrated thread and some comments may be shown as answers.
alireza
Top achievements
Rank 1
alireza asked on 10 Dec 2012, 10:39 AM
i cannot upload with kendo upload in ie .
ie not suport ??

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 11 Dec 2012, 07:58 AM
Hi,

The online demos appear to be working fine in IE9.

What version of IE are you using and what problems are you experiencing?

Greetings,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
alireza
Top achievements
Rank 1
answered on 11 Dec 2012, 08:39 AM
i using httphandle in asp.net
public class uploader : IHttpHandler
   {
    
       public void ProcessRequest(HttpContext context)
       {
            
           try
           {
               if (!string.IsNullOrEmpty(context.Request.QueryString["upload"]))
               {
                   HttpPostedFile postedFile = context.Request.Files["kendoFile1"];
                   string filepath = context.Server.MapPath("../js");
                   string filename = postedFile.FileName;
                   if (!Directory.Exists(filepath))
                       Directory.CreateDirectory(filepath);
                   postedFile.SaveAs(Path.Combine(filepath, filename));
                   context.Response.StatusCode = (int)HttpStatusCode.OK;
               }
              
               else if (!string.IsNullOrEmpty(context.Request.QueryString["remove"]))
               {
                   string filepath = context.Server.MapPath("../test");
                   string filename = context.Request.Form["fileNames"];
                   FileInfo file = new FileInfo(Path.Combine(filepath, filename));
                   file.Delete();
                   context.Response.StatusCode = (int)HttpStatusCode.OK;
               }
 
           }
           catch (Exception ex)
           {
               context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
           }
       }
 
       public bool IsReusable
       {
           get
           {
               return false;
           }
       }
   }
when upload in mozila file uploaded but ie 7,8,9 not uploaded .
when trace my code in mozila or ie
give me this errorr.
'(postedFile.InputStream).ReadTimeout' threw an exception of type 'System.InvalidOperationException'
qustion: why top code this error ?
i solved this problem by this code . now work fine in ie 7,8,9 and mozilla .
public class uploader : IHttpHandler
   {
    
       public void ProcessRequest(HttpContext context)
       {
            
           try
           {
 
               if (!string.IsNullOrEmpty(context.Request.QueryString["upload"]))
               {
 
                   HttpPostedFile postedFile = context.Request.Files["kendoFile1"];
                  BufferedStream bs = new BufferedStream(postedFile.InputStream);
                   int length = System.Convert.ToInt32(bs.Length);
                    byte[] zipFile = new byte[length];
                     int offset = 0;
                       int remaining = length;
                       while (remaining != 0)
                       {
                           int read = bs.Read(zipFile, offset, remaining);
                           if (read <= 0)
                               throw new EndOfStreamException(String.Format("End of stream reached with {0} bytes left to read", remaining));
                           remaining -= read;
                           offset += read;
                       }
                   string filepath = context.Server.MapPath("../test");
                   string filename = postedFile.FileName.Split('\\')[postedFile.FileName.Split('\\').Count() - 1];
                   if (!Directory.Exists(filepath))
                       Directory.CreateDirectory(filepath);
                   if (!(File.Exists(Path.Combine(filepath, filename))))
                   {
                        File.Create(Path.Combine(filepath, filename)).Close() ;
                       
                   }
                   File.WriteAllBytes(Path.Combine(filepath, filename), zipFile);
                   context.Response.StatusCode = (int)HttpStatusCode.OK;
               }
               else if (!string.IsNullOrEmpty(context.Request.QueryString["remove"]))
               {
                   string filepath = context.Server.MapPath("../test");
                   string filename = context.Request.Form["fileNames"];
                   FileInfo file = new FileInfo(Path.Combine(filepath, filename));
                   file.Delete();
                   context.Response.StatusCode = (int)HttpStatusCode.OK;
               }
 
           }
           catch (Exception ex)
           {
               context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
           }
       }
 
       public bool IsReusable
       {
           get
           {
               return false;
           }
       }
   }

thanks

Tags
Upload
Asked by
alireza
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
alireza
Top achievements
Rank 1
Share this question
or