473,513 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

10 New Member
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
Mar 31 '08 #1
5 5901
dlite922
1,584 Recognized Expert Top Contributor
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
Apr 4 '08 #2
BigM
10 New Member
duplicate post.....................
Apr 4 '08 #3
BigM
10 New Member
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
Apr 4 '08 #4
coolsti
310 Contributor
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\documents\work\

and the users have this mapped as

K:\documents\work or
L:\documents\work, 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
Apr 4 '08 #5
BigM
10 New Member
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
Apr 7 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2078
by: Alex'a X Spirit | last post by:
Hi, All OS: FreeBSD 4.9 php cgi 5.0 thttpd 2.25b PHP was compiled with options: --enable-discard-path --prefix=/usr/local/soft/php --without-pear
3
2319
by: Bush is a Fascist | last post by:
As an experiment I wrote a simple C program that invokes PHP using system(), but I'm getting an error "No input file specified.". What I do is: setenv ("REQUEST_METHOD", "GET", 1); setenv...
6
1826
by: Eric Lavigne | last post by:
Here is a shell command (MS-DOS): debug\curve-fit <input.txt >output.txt And here is a Python script that *should* do the same thing (and almost does): import os inputfilename =...
2
2878
by: Xam | last post by:
Hello everybody Do you know of a javascript routine that can warn if there are any pre-defined invalid chars in the filename of an INPUT file box before it is submitted with the submit button. ...
1
3207
by: Dave | last post by:
Hi, I'm using an HTML Input File control on a .Net page and when the Browse button is clicked the file dialog opens at the end user's hard drive. They want this to default to a server share. ...
0
1095
by: NathetJoel | last post by:
Hi! I have a problem using the input file, what I want to do is either send the file with an attachment or upload it on the server. When I do my test on my PC everything is OK but when I put it...
5
6077
by: jwright | last post by:
I have decided to use a struct to collect my data. The input file is comma dilineated between almost all of the fields. Here is the code I have so far and a sample input and output file. ...
6
31132
by: Hareth | last post by:
When i build the sample app baseclasses (that came with winfx sdk) i get an error: Error 1 fatal error LNK1181: cannot open input file 'strmiids.lib' BaseClasses I know where the 'strmiids.lib'...
4
1224
by: Reggie | last post by:
Hi and TIA! I have an Input file control on form that I want to pass a file path to. The page opens and I will pass the file path and name using the query string which I can obviously retrieve...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.