www.webdeveloper.com
Results 1 to 9 of 9

Thread: download page

  1. #1
    Join Date
    Feb 2006
    Location
    Springfield, MO
    Posts
    71

    download page

    Any suggestions on creating a page to download pdfs. I am creating a page where users can view a list of pdfs then download the one they want.

    the big issue is reading the files that are in the directory as we will be scanning the files directly to the folder.

    any suggestions would be helpful.
    Last edited by orionbrock32; 08-04-2006 at 04:17 PM.
    Buzzards got to eat same as worms.

  2. #2
    Join Date
    Apr 2003
    Posts
    71
    Look into ADODB.Stream. We are doing something similar where we pass the file id into an asp page, and using the adodb to load the file into the stream and stream the file down to the user.

  3. #3
    Join Date
    May 2006
    Location
    Sydney, Australia
    Posts
    125
    IF all the pdf's are in one directory use the File System Object to retreive all the files in the folder and write them to the screen.

    As long as they site in a directory that IIS can see, you can just us an A HREF tag for the end user to download them


    Something like this will help

    Code:
    sDepth = "/pdf/"
    	
    set oFSO = Server.CreateObject("Scripting.FileSystemObject")
    set oFolder = oFSO.GetFolder(server.MapPath(sDepth))
    
    FOR each oFile in oFolder.Files
        Response.write oFile.name & "<BR>"	
    NEXT
    
    set oFSO = nothing
    set oFolder = nothing
    </VANNY>

  4. #4
    Join Date
    Apr 2003
    Posts
    71
    Vanny's method will work but it must be in a directory IIS can see, and it also will allow your users to guess the filenames of other files in the directory that you may not want them to see. It depends on your requirements

  5. #5
    Join Date
    Feb 2006
    Location
    Springfield, MO
    Posts
    71
    Vanny,

    When i try your method i am getting a

    Microsoft VBScript runtime error '800a004c'

    Path not found

    /scanned_documents.asp, line 11

    error

    Code:
    sDepth = "/pdf/"
    	
    set oFSO = Server.CreateObject("Scripting.FileSystemObject")
    set oFolder = oFSO.GetFolder(server.MapPath(sDepth))
    
    FOR each oFile in oFolder.Files
        Response.write oFile.name & "<BR>"	
    NEXT
    
    set oFSO = nothing
    set oFolder = nothing
    line 11 is - set oFolder = oFSO.GetFolder(server.MapPath(sDepth))

    Is there something i need to change on there?
    Buzzards got to eat same as worms.

  6. #6
    Join Date
    Apr 2003
    Posts
    71
    Its saying it can not find the path to that folder. Does that folder reside on your file system?

  7. #7
    Join Date
    Feb 2006
    Location
    Springfield, MO
    Posts
    71
    they are in the general folder, do i need to create a folder for them?
    Buzzards got to eat same as worms.

  8. #8
    Join Date
    Apr 2003
    Posts
    71
    MapPath is looking for a folder called /pdf/. You need to tell that command the name of the folder where the files are. I would recommend creating a folder on your file system just for the files you want to be downloaded.

  9. #9
    Join Date
    Feb 2006
    Location
    Springfield, MO
    Posts
    71
    that did it, thanks. works great.

    we are using this for only one customer so there will not be a security issue with them seeing something they shouldn't.
    Buzzards got to eat same as worms.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles