anyone out there have something (or a reference to a tutorial) for a simple [mp3] file upload management script?

i need to allow for users to upload their [mp3] file (client side folder browsing would be awesome, but i would guess that makes it not "simple"). once i get the files into my db (assuming MySQL 4.1 can do it?), i'm going to need to do some custom script of my own which i want to be able to allow the user who uploaded that file to make comment about it. i'd also like to add just small-- even varchar for file title-- so the [mp3] file can then be downloaded by another user easily based on file-name.

anything come to mind?

if i can't store the file in the MySQL db, then i could do some workaround where the file would just go into a generic folder on my server, right? or am i being a little naive here that this can be "simple"?

    there should be plenty of examples of file uploading in the manual as per usuall. your best bet is to not try and store the files in the database. just store them on your filesystem and store the path, allong with the title and user comments in the database.

      Watch out for filesizes.... punters uploading large files over slower connections might start experiencing timeouts and causing you all sorts of grief.

        no worries about file sizes and slow transfers. this is to be a private resource for my band to share ideas.

        i'm curious-- if it's not a good idea to use MySQL for storing files, then why is it an available option? i don't get it. tell me about some horror stories, or something-- it's difficult to just accept the advice-- it's like saying "man, you don't want to eat that, trust me!". you're talkin' to a guy who eats anchovies on his pizza, ya know? most people don't like that either.
        😉

        it's not too late for me to go the PostGre SQL route-- would that be better?

        oh, regarding the manual-- of course that's an available resourse, but i'm looking for something that might have worked for someone already, or perhaps a URL to something at hotscripts. there's a vast amount of resources out there-- just trying to narrow it down a bit is all. surely you can understand that. i'm not looking for a lesson in learning PHP-- this is just something i want to do quick. i can learn it more in depth later. if no one has a script, or reference, then, of course that's understandable and completely acceptable as well. 🙂

          Keeping your database as small as possible makes it more efficient, run faster, use fewer resources etc etc

          Storing files in your database will make it much bigger.

          if you don't expect to be searching through the actual files themselves, but will be searching through the meta information (eg "files uploaded by Pete in November with 'Riot' in the title", and more than 30 MB in size"), then you have to ask yourself why you would bother making your database fat and inefficient by stuffing it with data you're never going to need to have in there?

            awww... i see, it's beginning to make more sense now. so, what then would be an alternative-- the smaller string and / or TEXT data would go into MySQL-- but what is done w/ the [mp3] files, and how does one typically make it so the user can stick those files in a server directory (and all seamlessly integrated w/ the mysql INSERT query which i presume would occur simultaneously) w/out having his or her own FTP account? is this a good example of the use of "annonymous FTP" (which i've never used, far as i know)?

              You could have the users upload all the information on one form.

              The form could prompt for information such as
              Song Name,
              Description,
              Commets

              And allow users to upload the actual file (the same way as the "advanced" form here allows people to uplaod attachments, or webmail clients allow users to upload attachments).

              The form could also add in information automatically, such as the id of the person doing the upload, date/time of the upload, file size etc

              you would then need a program which would take all of this information and insert the details into the database and copy the uploaded file to an appropriate directory.

              you mightn't even need to store the file location in the record. If each song gets its own record id on the songs table and you have a directory where you copy all the mp3's to, then you don't need any additional info. You just store the mp3 file in the preset directory with the id.mp3 as its filename.

              File uploading via form can be a little tricky to get right the first time as you're dealing with temporary files, temporary names etc, but once you get it right once, you should be fine. PM me if you'd be interested in having this work done for you.

              Your script which does all of the above updating would need to do a number of checks.
              - make sure that the input data is "safe"
              - make sure that the file seems ok
              - make sure that the record inserted and file updated correctly, otherwise cancel both (you don't want to insert the record then fail to process the file and end up with a record with no associated file. If you're familiar with the term, I'm talking about transactional processing here.

                justsomeone wrote:

                you would then need a program which would take all of this information and insert the details into the database and copy the uploaded file to an appropriate directory.

                are you saying that this would be a separate app... like an include being accessed or something?

                yeah, i'll PM you, but i'd like to keep the discussion public for anyone else who might benefit from the details.

                  you need a specific PHP script to process the inputs from the form which the user fills in. See your PM's for a little more detail.

                    ah! okay. thanks so much. never am i disappointed with what i find at PHPBuilder.com . sometimes it takes some tweaking of my own language to get at what i'm looking for, but the results are unsurpassed elsewhere!

                    EDIT:
                    i'd like to make clear, as a re-read has made me realize that it sounded like i was looking for "something for nothing", (ie. to get a script from any of you to do this). what i meant was, if you have a script-- or if you've coded something like this-- then maybe you could help me to find what i need to do my own.

                    i'm all about learning PHP the right way. i don't want to just take code-- one learns little that way, but to be guided to the right stack in the library definitely helps-- helps me at least. it's incredible the amount of learning i've gained from that type of guidance here.

                      Write a Reply...