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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to upload the file on another page?

how to upload the file on another page?

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestion
4 Posts 4 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
    Member 3879881
    wrote on last edited by
    #1

    Hi guys, In my string i have value like "picture.jpeg"..., now this string i want to assign in to fileupload control after it want to save in to my server url..., means using fileupload control i assign the file.., but not uploading the file in that page itself..., just passing the filename in to another page there i am uploading the file..., how to achive this...,

    Thanks & Regards, Member 3879881, please don't forget to vote on the post

    C K A 3 Replies Last reply
    0
    • M Member 3879881

      Hi guys, In my string i have value like "picture.jpeg"..., now this string i want to assign in to fileupload control after it want to save in to my server url..., means using fileupload control i assign the file.., but not uploading the file in that page itself..., just passing the filename in to another page there i am uploading the file..., how to achive this...,

      Thanks & Regards, Member 3879881, please don't forget to vote on the post

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can't change the text in the file upload control, and you cannot pass that text to another form, or get another form to read the file.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • M Member 3879881

        Hi guys, In my string i have value like "picture.jpeg"..., now this string i want to assign in to fileupload control after it want to save in to my server url..., means using fileupload control i assign the file.., but not uploading the file in that page itself..., just passing the filename in to another page there i am uploading the file..., how to achive this...,

        Thanks & Regards, Member 3879881, please don't forget to vote on the post

        K Offline
        K Offline
        keyur satyadev
        wrote on last edited by
        #3

        set your file name in session and when u click on upload button in next page use session value(i.e. filename).

        Regards Keyur Satyadev

        1 Reply Last reply
        0
        • M Member 3879881

          Hi guys, In my string i have value like "picture.jpeg"..., now this string i want to assign in to fileupload control after it want to save in to my server url..., means using fileupload control i assign the file.., but not uploading the file in that page itself..., just passing the filename in to another page there i am uploading the file..., how to achive this...,

          Thanks & Regards, Member 3879881, please don't forget to vote on the post

          A Offline
          A Offline
          amitabha123
          wrote on last edited by
          #4

          You can't change the text in the file upload control, and you cannot pass that text to another form, or get another form to read the file. But you can send the file as Stream. Here is an example. I used two page test-file-upload1.aspx ( from where user chhose the file to upload) and test-file-upload2.aspx( where the actual upload happens). test-file-upload.aspx.cs: ------------------------- protected void Button1_Click(object sender, EventArgs e) { Stream s = FileUpload1.FileContent; Session["test"] = s; Response.Redirect("test-file-upload2.aspx"); } test-file-upload.aspx.cs: ------------------------- string strPhysicalPath = ""; protected void Page_Load(object sender, EventArgs e) { strPhysicalPath = Server.MapPath("~/test-image/"); Stream fsInput = (Stream)(Session["test"]); byte[] bufferInput = new byte[fsInput.Length]; fsInput.Read(bufferInput, 0, bufferInput.Length); fsInput.Close(); //------------You can change the extension as original by sending the original extension in session FileStream fsOutput = File.Create(strPhysicalPath + "test.jpg"); fsOutput.Write(bufferInput, 0, bufferInput.Length); fsOutput.Close(); fsOutput.Dispose(); Response.Write("OK "); } I hope it solves your problem. Please mark it as answer if helps.

          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