Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using GetAbsolutePathName with File Input

    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>
    Last edited by Grayscale; 04-04-2006 at 01:56 PM.

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So isnt't it possible to get the full path by chosing the file? How can I do that?

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #5
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #7
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The code will work on the web server, not on the client's machine.

  • #8
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •