Web: How to Offer Custom Download? and Manage It?

This is a discussion on Web: How to Offer Custom Download? and Manage It? within the Tech Board forums, part of the Community Boards category; Here is the concept: A user has options: Red, Green, and Blue If the user pick "Red", a file will ...

  1. #1
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696

    Web: How to Offer Custom Download? and Manage It?

    Here is the concept:
    A user has options: Red, Green, and Blue
    If the user pick "Red", a file will be created, "Red" is written to it, and then the file is offered to be download.


    Here is what I come up with by myself. If you guys know better method, let me know. Also let me know if my system could potentially be abused.

    I will allow, say, 10 downloads at a time. So I'm gonna have file01-file10. When user enters his selection, I'm gonna check if there is a file among the ten that is not opened. If there is, selection is written to the file and offered to be downloaded. If not, prompt to try again later.


    EDIT:
    The filename has to be the same. So my quick and dirty solution is to create each of the ten files in ten different folders. Any thoughts?
    Last edited by alphaoide; 09-30-2004 at 07:22 PM.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Quote Originally Posted by alphaoide
    Here is the concept:
    A user has options: Red, Green, and Blue
    If the user pick "Red", a file will be created, "Red" is written to it, and then the file is offered to be download.


    Here is what I come up with by myself. If you guys know better method, let me know. Also let me know if my system could potentially be abused.

    I will allow, say, 10 downloads at a time. So I'm gonna have file01-file10. When user enters his selection, I'm gonna check if there is a file among the ten that is not opened. If there is, selection is written to the file and offered to be downloaded. If not, prompt to try again later.


    EDIT:
    The filename has to be the same. So my quick and dirty solution is to create each of the ten files in ten different folders. Any thoughts?
    Just have them send a query to your script and instead of
    "Content-type: text/html"

    print "Content-type: whatever"
    and then send them the download in binary mode.

    Actually I think it's different in PHP, because perl owns you.

  3. #3
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    I don't get what you saying about using "Content-type", and yeah, I prefer PHP solution, unless it's not possible.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    By changing the content type you're not bound to a certain protocol, which should make a lot of sense in this case since you're looking for a 'custom' soultion.

    ASP.NET could do something like this for sure, but for simplicity you're probably looking at doing something in Perl as Brian suggested. If the reality of your application is actually this simple, is there a reason you can't just link to files, "red.dat", "green.dat", "blue.dat", etc...?

  5. #5
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    >> By changing the content type you're not bound to a certain protocol
    Okay, I'm more of a web designer than a web programmer, so what do you mean by that and how is it relevant?

    Do you know if I could fopen(PHP) a file that is being downloaded? Or is there a way to know if a file is being downloaded?

    P.S. The custom file will contain 6 colors and each color is one of the 16bit colors, so I could not make all the files with every combination possible.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  6. #6
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    so you're saying these files have images in them? Or just text? Either way, php has both image creating functions, as well as the power to easily generate any one of those combinations on the fly quickly and easily. Could you elaborate a little bit on what's going on?
    PHP and XML
    Let's talk about SAX

  7. #7
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    What I'm offering for download is Cascading Style Sheet (.css) file.
    On the web page, there will be sliders for color Red, Green, and Blue. A specific combination values of RGB will generate a color theme (consists of x number of colors). The colors will be used to specify the color of text, hyperlink, background, etc that will be written into the CSS file.
    This CSS is for a particular web publishing platform. So the user will pick color, download custom CSS, upload to his website, and he'll get the layout with all the colors he picks without having to manually modify the downloaded CSS file.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  8. #8
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    that seems pretty easy man, you can create files with php, just create a temporary file then offer it for download. All you'd have to do is output the standard parts of the css to the file, then fill in the specific parts based on the variable from a user submitted form...that's pretty basic stuff...but what I think you really should do is just make your website more flexible, basically, output the css to your page, but the colors would be either a default value, or the value of a variable stored in a cookie on the users machine. Then you can avoid the whole downloading thing, and avoid having to help people who don't know how to apply the stylesheet to the page. Cookies are a lot easier to deal with.
    PHP and XML
    Let's talk about SAX

  9. #9
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    The custom CSS is for *their* own websites NOT *mine*
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  10. #10
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    well scratch the cookie idea, go with what I first said in my last post.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21