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. How to upload a file to my webserver from another url?

How to upload a file to my webserver from another url?

Scheduled Pinned Locked Moved ASP.NET
tutorialcomquestion
6 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.
  • I Offline
    I Offline
    InvalidTypecast
    wrote on last edited by
    #1

    I know how to upload a file from my local disk to the webserver, but how would I pass in a URL of a file located on a webserver instead of my local drive? In other words I want to be able to pass in "http://www.example.com/fileName.xyz" and have fileName.xyz upload to a location I want on my webserver. I was having trouble finding the right keywords to ask google :) Has anyone done this before?

    C S 2 Replies Last reply
    0
    • I InvalidTypecast

      I know how to upload a file from my local disk to the webserver, but how would I pass in a URL of a file located on a webserver instead of my local drive? In other words I want to be able to pass in "http://www.example.com/fileName.xyz" and have fileName.xyz upload to a location I want on my webserver. I was having trouble finding the right keywords to ask google :) Has anyone done this before?

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

      You can't do that, unless the file itself is both visible in your web server, and your web server will serve it, when requested. A better approach, would be to use web services to pass the file around, if you have access to both ends of the equation.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      I 1 Reply Last reply
      0
      • C Christian Graus

        You can't do that, unless the file itself is both visible in your web server, and your web server will serve it, when requested. A better approach, would be to use web services to pass the file around, if you have access to both ends of the equation.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        I Offline
        I Offline
        InvalidTypecast
        wrote on last edited by
        #3

        There must be a way of (it doesn't have to be via the file upload control) passing the url of a file to your program and having it download the file to a specific location on the web server.

        I 1 Reply Last reply
        0
        • I InvalidTypecast

          There must be a way of (it doesn't have to be via the file upload control) passing the url of a file to your program and having it download the file to a specific location on the web server.

          I Offline
          I Offline
          InvalidTypecast
          wrote on last edited by
          #4

          Ok I think this should work. I haven't had a moment to check it yet though. If I am iterating through a series of these will this wait for the download to complete? WebClient wc = new WebClient(); wc.DownloadFile("http://www.example.com/exampleImage.jpg", Server.MapPath("images"));

          1 Reply Last reply
          0
          • I InvalidTypecast

            I know how to upload a file from my local disk to the webserver, but how would I pass in a URL of a file located on a webserver instead of my local drive? In other words I want to be able to pass in "http://www.example.com/fileName.xyz" and have fileName.xyz upload to a location I want on my webserver. I was having trouble finding the right keywords to ask google :) Has anyone done this before?

            S Offline
            S Offline
            sathesh pandian
            wrote on last edited by
            #5

            hi, you have to access(read and write) tht file and save it in your web server. you have to use file concepts for this purpose. all the best

            Sathesh Pandian

            I 1 Reply Last reply
            0
            • S sathesh pandian

              hi, you have to access(read and write) tht file and save it in your web server. you have to use file concepts for this purpose. all the best

              Sathesh Pandian

              I Offline
              I Offline
              InvalidTypecast
              wrote on last edited by
              #6

              I got it working using my example above. Thanks for the advice everyone.

              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