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. fileupload postback

fileupload postback

Scheduled Pinned Locked Moved ASP.NET
sysadmin
5 Posts 3 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.
  • M Offline
    M Offline
    m dhu
    wrote on last edited by
    #1

    im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks

    /to display image
    //button click
    string virtualFolder = "~/Uploads1/";
    string physicalFolder = Server.MapPath(virtualFolder);
    FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
    Image1.Visible = true;
    Image1.ImageUrl = virtualFolder + FileUpload1.FileName;

    P K 2 Replies Last reply
    0
    • M m dhu

      im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks

      /to display image
      //button click
      string virtualFolder = "~/Uploads1/";
      string physicalFolder = Server.MapPath(virtualFolder);
      FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
      Image1.Visible = true;
      Image1.ImageUrl = virtualFolder + FileUpload1.FileName;

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      --Try this-- String virtualFolder = Server.MapPath(@"Uploads1\\"); if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; virtualFolder += fileName; FileUpload1.SaveAs(virtualFolder); } else { //error statement }

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      M 1 Reply Last reply
      0
      • P padmanabhan N

        --Try this-- String virtualFolder = Server.MapPath(@"Uploads1\\"); if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; virtualFolder += fileName; FileUpload1.SaveAs(virtualFolder); } else { //error statement }

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        M Offline
        M Offline
        m dhu
        wrote on last edited by
        #3

        no its same as page is posted back...

        1 Reply Last reply
        0
        • M m dhu

          im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks

          /to display image
          //button click
          string virtualFolder = "~/Uploads1/";
          string physicalFolder = Server.MapPath(virtualFolder);
          FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
          Image1.Visible = true;
          Image1.ImageUrl = virtualFolder + FileUpload1.FileName;

          K Offline
          K Offline
          kPriyanka12
          wrote on last edited by
          #4

          I think we can not display the name of the file which is uploaded because property fileupload.filename is readonly and it can be set only if user browse the image

          M 1 Reply Last reply
          0
          • K kPriyanka12

            I think we can not display the name of the file which is uploaded because property fileupload.filename is readonly and it can be set only if user browse the image

            M Offline
            M Offline
            m dhu
            wrote on last edited by
            #5

            actually what im trying is to upload a image and display its thumbnail.. and then insert into into database.. but as once page is posted fileupload is empty there is no path to insert into database.... any other method....

            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