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. File viewing from another directory

File viewing from another directory

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

    Hi, In my website there is a file upload page, where users upload some files. I have another web applications where i have to develop a page to view the previously uploaded files. the problem is that the files are in another directory. Can anyone solve my problem? Thanks and regards

    ARINDAM

    T 1 Reply Last reply
    0
    • C CrazyCoder26

      Hi, In my website there is a file upload page, where users upload some files. I have another web applications where i have to develop a page to view the previously uploaded files. the problem is that the files are in another directory. Can anyone solve my problem? Thanks and regards

      ARINDAM

      T Offline
      T Offline
      tech603
      wrote on last edited by
      #2

      This should help you out http://msdn.microsoft.com/en-us/library/5cf8zcfh.aspx[^]

      Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com

      C 1 Reply Last reply
      0
      • T tech603

        This should help you out http://msdn.microsoft.com/en-us/library/5cf8zcfh.aspx[^]

        Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com

        C Offline
        C Offline
        CrazyCoder26
        wrote on last edited by
        #3

        thanks for your response Matthew... But this is not my solution. I am explaining my problem a bit elaborately. My fileupload web application uploads file in say : c:/Directory1. But the web application where users views the files are in d:/Directory2. I am listing the uploaded files in a listbox control... which I am being able to do. Now when a user clicks one item in listbox it just sets the "href" attribute of an hyperlink with "c:/Directory1/" + filename. But since the files are on another directory, when I click on the hyperlink it does not respond,but on the browser window status bar I can see the path which is assigned to it's href attribute and it's proper.

        ARINDAM

        N R 2 Replies Last reply
        0
        • C CrazyCoder26

          thanks for your response Matthew... But this is not my solution. I am explaining my problem a bit elaborately. My fileupload web application uploads file in say : c:/Directory1. But the web application where users views the files are in d:/Directory2. I am listing the uploaded files in a listbox control... which I am being able to do. Now when a user clicks one item in listbox it just sets the "href" attribute of an hyperlink with "c:/Directory1/" + filename. But since the files are on another directory, when I click on the hyperlink it does not respond,but on the browser window status bar I can see the path which is assigned to it's href attribute and it's proper.

          ARINDAM

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          That shows you have no idea on web applications. Physical path like c:/directory will not work with web applications. It can access only directories which are under it's website space. So you have to keep your upload files in a directory inside your website area. :)

          Navaneeth How to use google | Ask smart questions

          C 1 Reply Last reply
          0
          • C CrazyCoder26

            thanks for your response Matthew... But this is not my solution. I am explaining my problem a bit elaborately. My fileupload web application uploads file in say : c:/Directory1. But the web application where users views the files are in d:/Directory2. I am listing the uploaded files in a listbox control... which I am being able to do. Now when a user clicks one item in listbox it just sets the "href" attribute of an hyperlink with "c:/Directory1/" + filename. But since the files are on another directory, when I click on the hyperlink it does not respond,but on the browser window status bar I can see the path which is assigned to it's href attribute and it's proper.

            ARINDAM

            R Offline
            R Offline
            Ravindra Bisen
            wrote on last edited by
            #5

            hi try this using System.IO; and String DocPath = Session["DocPath"].ToString(); //here Docpath = "~/Documents/18abc.jpg" string path = Server.MapPath(DocPath); //here path = "Y:\\testsite\\Myfolder\\Documents\\18abc.jpg" System.IO.FileInfo file = new System.IO.FileInfo(path); if (file.Exists) { Image1.ImageUrl = path; //or you can use direct path Image1.ImageUrl = "htt://www.yoursite/folder/file.jpg"; } this may help you :rose:

            1 Reply Last reply
            0
            • N N a v a n e e t h

              That shows you have no idea on web applications. Physical path like c:/directory will not work with web applications. It can access only directories which are under it's website space. So you have to keep your upload files in a directory inside your website area. :)

              Navaneeth How to use google | Ask smart questions

              C Offline
              C Offline
              CrazyCoder26
              wrote on last edited by
              #6

              I have just done it making an ftp site

              ARINDAM

              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