...

View Full Version : Using GetAbsolutePathName with File Input



Grayscale
04-04-2006, 01:52 PM
Hello,

I have two asp pages and try to get the folder & file name which is selected on the first page but when I select any file and press submit, it shows the folder as "C:\Windows\System32\-filename-" but I want to show actual folder. When I use "text" as the input type, there is no problem. Also I tried to use Request. Form method only but it shows only the file name not the directory. So I decided to use GetAbsolutePathName too. But it doesn't work for me. I'll be glad if you help me to solve this problem.

--name1.asp--
<html>
<head>
<body>
<form action="name2.asp"
method="post">
Dosya ismi:
<input type="file" name="fname">
<input type="submit" value="Submit">
</form>
</body>
</head>
</html>


--name2.asp--
<html>
<head>
<body>
<%
dim fs, path, name
set fs=Server.CreateObject("Scripting.FileSystemObject")
name=Request.Form("fname")
path=fs.GetAbsolutePathName(name)
response.write(path)
%>
</body>
</head>
</html>

degsy
04-04-2006, 03:03 PM
The type="file" cannot get those details. It is getting the data from the clients machine but the browser does not send the full path.

Grayscale
04-04-2006, 03:06 PM
So isnt't it possible to get the full path by chosing the file? How can I do that?

degsy
04-04-2006, 03:11 PM
How are you using your code? Why are you letting the client choose a file from their system and then you are scripting from the webserver?

Grayscale
04-04-2006, 03:26 PM
I need the path to use it as a variable to specify the text file object. For example:

Set objTextFile = objFSO.OpenTextFile ("c:\Inetpub\wwwroot\record\data.txt", ForReading)

I'll need to select other text files to change the specified file and don't want to change the code each time I execute it.

So I need something like this:
Set objTextFile = objFSO.OpenTextFile (-#-variable-#-, ForReading)

The variable will be equal to selected file's path. That's the reason why I need the path.

degsy
04-04-2006, 03:41 PM
The file type box is on the clients machine. The do not have the path or structure of the webserver.
How do you hope to combine or compare against them?

Grayscale
04-04-2006, 04:39 PM
The code will work on the web server, not on the client's machine.

degsy
04-05-2006, 02:24 PM
Yes, but if you open the page in a browser then you are the client. You still go through the web user account the same as any other user.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum