Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. while uploading Photo,not seen in IE7 but seen in IE6

while uploading Photo,not seen in IE7 but seen in IE6

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Learning IT
    wrote on last edited by
    #1

    how to resolve compatibilty problem with IE7,this code also makes duplicate copies of photo in my image folder,how to resolve dat problem too,i am uploading the photo by using this code-:

    static byte\[\] bydoctemp;
    static Int32 intDocLength\_img = 0;
    Stream objStream\_img;
    

    protected void bttn_upload_photo_Click(object sender, EventArgs e)
    {
    intDocLength_img = FileUpload1.PostedFile.ContentLength;

        bydoctemp = new byte\[intDocLength\_img\];
    
        objStream\_img = FileUpload1.PostedFile.InputStream;
    
        objStream\_img.Read(bydoctemp, 0, intDocLength\_img);
    

    previewField.Attributes.Add("src", FileUpload1.PostedFile.FileName);

    private static string RandomString()
    {
    int size = 10;
    Random r = new Random();
    string legalChars = "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY123456789";
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < size; i++)
    sb.Append(legalChars.Substring(r.Next(0, legalChars.Length - 1), 1));
    return sb.ToString();
    }

    private long m\_lImageFileLength = 0;
    private byte\[\] m\_barrImg;
    public byte\[\] load\_binary(string filepath)
    {
        if (filepath.Trim() != "")
        {
            FileInfo fiImage = new FileInfo(filepath);
            this.m\_lImageFileLength = fiImage.Length;
            FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read);
            m\_barrImg = new byte\[Convert.ToInt32(this.m\_lImageFileLength)\];
            int iBytesRead = fs.Read(m\_barrImg, 0, Convert.ToInt32(this.m\_lImageFileLength));
            fs.Close();
        }
        else
        {
            m\_barrImg = new byte\[0\];
        }
        return m\_barrImg;
    }
    

    //storing in database

    //upload
    if (intDocLength_img > 1)
    {
    cmd.Parameters[68].Value = bydoctemp;

        }
    
        else
        {
            HF1.Value = "";
            cmd.Parameters\[68\].Value = load\_binary(HF1.Value);
            previewField.Attributes.Add("src", "..\\\\layout\_images\\\\Untitled-1.gif");
    
        }
    

    can anyone have the code for uploading photo in asp.net dat is fully compatible with IE6 as well as IE7,thanks in advance

    Maniiiiiiiiiiiiiii

    L 1 Reply Last reply
    0
    • L Learning IT

      how to resolve compatibilty problem with IE7,this code also makes duplicate copies of photo in my image folder,how to resolve dat problem too,i am uploading the photo by using this code-:

      static byte\[\] bydoctemp;
      static Int32 intDocLength\_img = 0;
      Stream objStream\_img;
      

      protected void bttn_upload_photo_Click(object sender, EventArgs e)
      {
      intDocLength_img = FileUpload1.PostedFile.ContentLength;

          bydoctemp = new byte\[intDocLength\_img\];
      
          objStream\_img = FileUpload1.PostedFile.InputStream;
      
          objStream\_img.Read(bydoctemp, 0, intDocLength\_img);
      

      previewField.Attributes.Add("src", FileUpload1.PostedFile.FileName);

      private static string RandomString()
      {
      int size = 10;
      Random r = new Random();
      string legalChars = "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY123456789";
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < size; i++)
      sb.Append(legalChars.Substring(r.Next(0, legalChars.Length - 1), 1));
      return sb.ToString();
      }

      private long m\_lImageFileLength = 0;
      private byte\[\] m\_barrImg;
      public byte\[\] load\_binary(string filepath)
      {
          if (filepath.Trim() != "")
          {
              FileInfo fiImage = new FileInfo(filepath);
              this.m\_lImageFileLength = fiImage.Length;
              FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read);
              m\_barrImg = new byte\[Convert.ToInt32(this.m\_lImageFileLength)\];
              int iBytesRead = fs.Read(m\_barrImg, 0, Convert.ToInt32(this.m\_lImageFileLength));
              fs.Close();
          }
          else
          {
              m\_barrImg = new byte\[0\];
          }
          return m\_barrImg;
      }
      

      //storing in database

      //upload
      if (intDocLength_img > 1)
      {
      cmd.Parameters[68].Value = bydoctemp;

          }
      
          else
          {
              HF1.Value = "";
              cmd.Parameters\[68\].Value = load\_binary(HF1.Value);
              previewField.Attributes.Add("src", "..\\\\layout\_images\\\\Untitled-1.gif");
      
          }
      

      can anyone have the code for uploading photo in asp.net dat is fully compatible with IE6 as well as IE7,thanks in advance

      Maniiiiiiiiiiiiiii

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      rename the pic manually so when it make the pic it override it

      The Web Developer. Beirout-Lebanon

      L 1 Reply Last reply
      0
      • L Lost User

        rename the pic manually so when it make the pic it override it

        The Web Developer. Beirout-Lebanon

        L Offline
        L Offline
        Learning IT
        wrote on last edited by
        #3

        i dont understand,can u plz explain it as how should i do it...

        Maniiiiiiiiiiiiiii

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups