SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I just finished doing 2 smaller projects in php/mysql and was thinking about starting a bigger one. One of the sites that i maintain has a top 20 list of songs and another list of songs all in the real audio format. Each song has its corresponding fields title, artist etc....

    I would like to create a system that the client would be able to use that would enable them to upload files to a mysql database(not sure how to do this) and then the *.ram file would need to be generated (is this possible using php). I need to create *.ram files because I do not have access to a real media server for streaming

    There is some other things that I was considering as well such as keeping track of which songs have been listened to most and a vote feature etc... but I dont think those will be to difficult to do once I get the infrastructure down.

    Any help on the issues of uploading to a database and creating *.ram files using php will be appreciated.

    Thanks,

    CMystikal

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know a .ram file just contains the address of the .rm file.

    As for storing the files in a database, that is not very difficult to do all you need to do is open the file (fopen) and read it in then store it in a binary field in your database. The way of getting it out again is to output the contents of the file to the browser (print) after you have sent the content type header ( header("Content-type: xxxx\n\n") ) which would be the correct mime type for the .rm file.

    ------------------
    Karl Austin
    KDA Web Services
    "Everyone has a photographic memory. Some just don't have film."

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yup -- the only stumbling block will be converting whatever format your users upload into the Real Media format. Unfortunately, PHP has no in-built support for this. If you can find an external program that does this from the command line, you could run the program from within PHP using exec().


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  4. #4
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    I was wondering if it would b possible to use php to create the *.ram files though?

  5. #5
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Assuming you can guarantee that you users will send you .rm files, then creating the .ram files would just be a matter of telling PHP to output a file with the .rm's filename in it.

    Can you guarantee that?


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  6. #6
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yup because it would most likely be me or one other person sending the *.rm files.. where could i find resources on this (using php to create files)

    Thanks for the help,

    CMystikal


  7. #7
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you "can" store binary code in mysql in a BLOB field

    you would take the uploaded file, read it into a variable, and escape all the ' things, and then dump it into mysql with a query

    once its in, you can pull it out , with a php script, and ofcourse, you would have to pass a new header() with the content type for RA/RAM files ...

    ----------------------
    SitePoint Moderator
    my ONLY host . com

  8. #8
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    All of the PHP file system functions are documented here: http://www.php.net/manual/ref.filesystem.php

    Let me know if the examples in the manual aren't enough for you!

    Note that under Unix, the user account in which the Web server is running must have write access to the directory in which you are attempting to create/write the files.



    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  9. #9
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by cmystikal:
    I would like to create a system that the client would be able to use that would enable them to upload files to a mysql database<HR></BLOCKQUOTE>

    hehe, kevin, he wouldnt need to worry about file permissions if he's dumping the binary data into mySQL .. as far as i know and have done in the past


  10. #10
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again for all the help!

    those php fuctions will come in usefull once I get by my first stumbling block.

    How would i create a 'browse' button which would allow the user to choose files from their hardrive to upload... how would I go about doing that and how could i direct the files to be sent to the desired directory

  11. #11
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sit tight: Part 10 of my article series will cover handling file uploads.


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  12. #12
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I will be looking forward to it... BTW your series is very good, usefull and informative. Nice examples that clearly illustrate the concepts.. keep up the good work!


Bookmarks

Posting Permissions

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