Results 1 to 6 of 6

Thread: ASP to download file outside web space

  1. #1
    Does he need a reason? Funkstar's Avatar
    Join Date
    Aug 2005
    Location
    Aberdeen
    Posts
    19,874
    Thanks
    630
    Thanked
    965 times in 816 posts
    • Funkstar's system
      • Motherboard:
      • Gigabyte EG45M-DS2H
      • CPU:
      • Intel Core2Quad Q9550 (2.83GHz)
      • Memory:
      • 8GB OCZ PC2-6400C5 800MHz Quad Channel
      • Storage:
      • 650GB Western Digital Caviar Blue
      • Graphics card(s):
      • 512MB ATI Radeon HD4550
      • PSU:
      • Antec 350W 80+ Efficient PSU
      • Case:
      • Antec NSK1480 Slim Mini Desktop Case
      • Operating System:
      • Vista Ultimate 64bit
      • Monitor(s):
      • Dell 2407 + 2408 monitors
      • Internet:
      • Zen 8mb

    ASP to download file outside web space

    I've not done any ASP or web development in a couple of years and a friend has asked me to knock together some simple pages. Most of it isn't a problem but he would like to be able to upload a new CV whenever he updates his (freelance writer/producer/director so updates it a lot). Uploading is fine, i've got that sorted thanke to a nice free script.

    However, it needs to be uploaded outside of the public web space. How can i download this file? I've searched for scripts, but i'm not having much success, i only need it to download this file seamlessly from once page, everything i have found is for complicated download managers.

    Anyone help me out with this? I can't imagine it would be a lot of code, although i could be wrong

    thanks for any help you can give me.

  2. #2
    Senior Member Shad's Avatar
    Join Date
    Jul 2003
    Location
    In front
    Posts
    2,782
    Thanks
    23
    Thanked
    42 times in 25 posts
    Nice and easy if you're writing this in .NET

    Just create a new IO stream against the file in its present location and send it to the page output stream. You could also play around with the header too, to change the file name and content disposition (type), etc. It's a well documented thing.

    No more than about... 5 lines of code

    Unless you're stuck with classic ASP.......
    Simon


  3. #3
    Does he need a reason? Funkstar's Avatar
    Join Date
    Aug 2005
    Location
    Aberdeen
    Posts
    19,874
    Thanks
    630
    Thanked
    965 times in 816 posts
    • Funkstar's system
      • Motherboard:
      • Gigabyte EG45M-DS2H
      • CPU:
      • Intel Core2Quad Q9550 (2.83GHz)
      • Memory:
      • 8GB OCZ PC2-6400C5 800MHz Quad Channel
      • Storage:
      • 650GB Western Digital Caviar Blue
      • Graphics card(s):
      • 512MB ATI Radeon HD4550
      • PSU:
      • Antec 350W 80+ Efficient PSU
      • Case:
      • Antec NSK1480 Slim Mini Desktop Case
      • Operating System:
      • Vista Ultimate 64bit
      • Monitor(s):
      • Dell 2407 + 2408 monitors
      • Internet:
      • Zen 8mb
    i *think* it is .net as there is a couple of .net folders in the webspace. however i have no idea how to do what you just said

    I emailed the hosting provider and they said something similar, but again i have no idea how to go about it.

    You are correct that you need a separate download.asp to do this. We do not provide code, but basically you would need to set the header
    (Content-Type: image/gif, or whatever) and then output the binary contents of the file. More information on this is available on the many ASP coding sites.

    We hope this e-mail was of use to you. If you require any further information or have further queries, please do not hesitate to contact us.

    Best regards,

    John
    NetWeaver.com Limited

  4. #4
    TiG
    TiG is offline
    Walk a mile in other peoples shoes...
    Join Date
    Jul 2003
    Location
    Questioning it all
    Posts
    6,213
    Thanks
    45
    Thanked
    48 times in 43 posts
    When you say file outside of the web space?, how are you accessing this file, is it on his machine or what?. i'm trying to understand what you are really asking for.

    The reason you confuse me is that you keep refering to downloading.

    TiG
    -- Hexus Meets Rock! --

  5. #5
    Senior Member Shad's Avatar
    Join Date
    Jul 2003
    Location
    In front
    Posts
    2,782
    Thanks
    23
    Thanked
    42 times in 25 posts
    I believe he means the files that need to be downloaded are above the root level of the website. So the program will need to load the contents of the file from its present location into a memory buffer (via an IO stream), and 'dump' it to the current page context's output stream.

    As I said, it's quite a well documented thing particularly with .NET
    Simon


  6. #6
    Does he need a reason? Funkstar's Avatar
    Join Date
    Aug 2005
    Location
    Aberdeen
    Posts
    19,874
    Thanks
    630
    Thanked
    965 times in 816 posts
    • Funkstar's system
      • Motherboard:
      • Gigabyte EG45M-DS2H
      • CPU:
      • Intel Core2Quad Q9550 (2.83GHz)
      • Memory:
      • 8GB OCZ PC2-6400C5 800MHz Quad Channel
      • Storage:
      • 650GB Western Digital Caviar Blue
      • Graphics card(s):
      • 512MB ATI Radeon HD4550
      • PSU:
      • Antec 350W 80+ Efficient PSU
      • Case:
      • Antec NSK1480 Slim Mini Desktop Case
      • Operating System:
      • Vista Ultimate 64bit
      • Monitor(s):
      • Dell 2407 + 2408 monitors
      • Internet:
      • Zen 8mb
    Not had a chance to do anything with this tonight, i'll look into it tomorrow some more.

    When you ftp into the account you have /data/ and /public_html/ inside public_html is what is normally accessable from the domain (eg. /public_html/page.asp is the same as www.domain.com/page.asp) public_html is not writable by the webservice, so when i upload files through a form on a web page, i have to upload it to /data/ which is writable by the web service but is outside the public web space. This is the same directory that any databases are stored.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 63
    Last Post: 14-11-2011, 09:17 AM
  2. Free web space with no adverts and building advice
    By Allen in forum Networking and Broadband
    Replies: 4
    Last Post: 18-01-2004, 04:03 PM
  3. Cheap web space
    By MAS in forum Networking and Broadband
    Replies: 1
    Last Post: 11-10-2003, 06:42 PM

Posting Permissions

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