input=file : how to get actual path, not mapped drive letter?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BigM
    New Member
    • Aug 2007
    • 10

    input=file : how to get actual path, not mapped drive letter?

    Hi Guys,

    I am working up a little 'documents' section to an app of mine, where people can add links to docs on various share drives in our LAN, and they are displayed along with other details and can be clicked to open.

    Everything works well using an input=file then an onchange to update a hidden text field to capture the whole directory, but at the moment when saving a link, the uri (as such) is starting with the mapped drive letter on my system. Fine for me, but no good if someone who has a particular drive mapped to another letter wants to use the link.

    Is there any way to force the code to take the full path (ie: \\server\share$ \), not just the mapped drive letter (G:\) ?

    Only alternative if not I suppose is to make everyone put things in one share location if they want to link to it, then trim the drive letter and replace with the server name....

    Any help greatly appreciated as always! :)

    JM
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    not sure why you're linking to images that are already on the server.

    It seems like you're getting that from the user, which can give you a image URL with ANY drive letter.

    You're basically asking how can I predict what mapped folder their letter is mapping to. Simply put, you can't, nor can PHP. (Call Miss Cleo?)

    However, You have a couple of ways to do this:

    1. Upload the image to the server. This may seem redundant if its actually the same server.

    2. Make them enter the path \\server1\path\ to\image, instead of G:\

    3. Upload all the images in question to the webserver and have them Choose one from a "gallery" section and add info to it.

    I don't know what images, or what the context is, so that's as much as I can help unless anybody else has some ideas.

    Cheers,


    DM

    Comment

    • BigM
      New Member
      • Aug 2007
      • 10

      #3
      duplicate post........... ..........

      Comment

      • BigM
        New Member
        • Aug 2007
        • 10

        #4
        Hi DM,

        Maybe you have images on the brain for some reason, but I'm not doing anything with images. :D

        This is for making a hyperlink you can click to open word docs and spreadsheets that relate to a project and are already saved on managed storage, so it's pointless to upload them to my system, it would also mean having to re-upload them any time changes were made.

        There are a couple of places the files could be, and I wanted to have the nice browse for file interface, rather than making people type //server/share/path... which they might not even remember, some of the drives I have mapped have been so for a long time, I can't remember all the paths behind them. :)

        Anyway, sounds like there is no way to really do it other than forcing people to only put documents on one share if it's going to be uploaded here, then strip the drive letter and replace with server/share details before writing to the db.... Which is a shame, but better than others not being able to access things.

        Thanks,
        JM

        Comment

        • coolsti
          Contributor
          • Mar 2008
          • 310

          #5
          I understand the problem. You have a server and directories on that server are mapped to individual client PC's to drive letters but not necessarilly the same letter. Sam might have it mapped to K: while Pete may have it mapped to L:

          Using an html browse functionality to grab the path will get you the user's own drive letter, and that is ok for that user on that PC, but what if the idea of the script is to save the path somewhere, like in a database, so that everyone else can also access it. This is your problem I think.

          I do not know if you can get the HTML browse facility to report the actual server path rather than the mapped drive letter. I would imagine you cannot.

          But you may be able to do something else. If you are more or less aware of the actual server directory structure and can predict what the true path should be, you can have your PHP scripts on the server convert the user input into the correct path. Here an example:

          Let us say you know that your server has the path

          \\server\home\d ocuments\work\

          and the users have this mapped as

          K:\documents\wo rk or
          L:\documents\wo rk, etc. etc.

          Then you have your PHP script strip off everything before the first \ symbol and prepend the string \\server\home.

          I don't know how you will deal with the reverse part though, where a user needs to convert the stored path to the correctly mapped drive letter on his or her machine :)

          I have similar issues with my applications at work, but the entire company has just agreed on the same drive letter mappings for all server drives.

          Steve, Denmark

          Comment

          • BigM
            New Member
            • Aug 2007
            • 10

            #6
            Hi Steve,

            Yep you are spot on, exactly the scenario I am trying to deal with.

            I thought a "find/replace" would be the only solution, which just means forcing everyone to use a single share (we have a few...) which isn't such a big deal, the majority of docs should be on that one anyway.

            I just thought it was worth asking the question whether the unc path could be obtained, just for a bit of extra flexibility.

            Thanks guys.

            John

            Comment

            Working...