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. Retrive file path back in to fileupload control......

Retrive file path back in to fileupload control......

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasetutorialquestion
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.
  • P Offline
    P Offline
    pranavcool
    wrote on last edited by
    #1

    Hi, I am using a fileupload control in my .net project.I am storing the file name in to the database. Now my question is that it is possible to retrive the filename will full path back in to the fileupload while updating the record. For example i am storing a file name "xyz.jpg" in to the database.And the file is stored in some folder say ../images/xyz.jpg. so is it possible to get back the full path with the file name back in to the fileupload control. If it is possible please let me know. Regards, Pranav

    Pranav Dave

    A M A 3 Replies Last reply
    0
    • P pranavcool

      Hi, I am using a fileupload control in my .net project.I am storing the file name in to the database. Now my question is that it is possible to retrive the filename will full path back in to the fileupload while updating the record. For example i am storing a file name "xyz.jpg" in to the database.And the file is stored in some folder say ../images/xyz.jpg. so is it possible to get back the full path with the file name back in to the fileupload control. If it is possible please let me know. Regards, Pranav

      Pranav Dave

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      why dont you use Request.PhysicalPath to get the current physical path and add the relative to it.

      Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
      Create .NET Templates

      1 Reply Last reply
      0
      • P pranavcool

        Hi, I am using a fileupload control in my .net project.I am storing the file name in to the database. Now my question is that it is possible to retrive the filename will full path back in to the fileupload while updating the record. For example i am storing a file name "xyz.jpg" in to the database.And the file is stored in some folder say ../images/xyz.jpg. so is it possible to get back the full path with the file name back in to the fileupload control. If it is possible please let me know. Regards, Pranav

        Pranav Dave

        M Offline
        M Offline
        Matt Cavanagh
        wrote on last edited by
        #3

        If im understanding you right, then no, I dont think you can do that as it would cause quite a security risk. Because what if you set the directory to some personel documents...

        1 Reply Last reply
        0
        • P pranavcool

          Hi, I am using a fileupload control in my .net project.I am storing the file name in to the database. Now my question is that it is possible to retrive the filename will full path back in to the fileupload while updating the record. For example i am storing a file name "xyz.jpg" in to the database.And the file is stored in some folder say ../images/xyz.jpg. so is it possible to get back the full path with the file name back in to the fileupload control. If it is possible please let me know. Regards, Pranav

          Pranav Dave

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

          If your are using ASP.NET then you may use ~ (root) operator to resolve path with server controls. Save ~/images/xyz.jpg in database. However, you said "Is it possible to get back full path?". Yes you can: Use, Server.MapPath or Request.MapPath or MapPath method. eg. String fullpath=Request.MapPath("~/images/xyz.jpg"); or String fullpath=Request.MapPath("../images/xyz.jpg");

          A DATAPOST COMPUTER CENTRE (K.V Prajapati)

          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