|
-
May 23rd, 2009, 07:00 PM
#1
Thread Starter
Member
Upload files and add to SQL?
Hi, I'm coding a LUA addon for a game, I'm streaming music to the game through my web server, and the list of songs is in a database with the fields: name, artist, album, min, and sec. I've managed to make a PHP script that adds those fields to the database, but then I have to go into the FTP, add the file in exactly the right place, etc. I was wondering if I could get some pointers on how to make an upload script that would take the fields I put in for the database, and make it upload to that directory, and add to the database at the same time. And example would be
Name: Test Song
Artist: That one guy
Album: The best one ever
Minutes: 3
Seconds: 24
Then I'd pick an mp3 and press 'Submit'. It would then upload that file to /That one guy/The best one ever/Test Song.mp3
I'd feel bad asking for someone to just hand me the code, so I'm asking for some good tips. I'm new to PHP and fairly new to SQL, and I'm sure this is pretty complicated, but any help would be greatly appreciated! Thanks in advanced
-
May 23rd, 2009, 08:09 PM
#2
-
May 23rd, 2009, 08:11 PM
#3
Thread Starter
Member
Re: Upload files and add to SQL?
I got the file upload working, but I also need it to change where it uploads and add to the database. I put the database script in the upload script, and it gave me errors all over. Not sure why.
-
May 24th, 2009, 03:48 AM
#4
Re: Upload files and add to SQL?
well, if you have a script that you add songs to the database with already, you can just add a file upload to it and then save the file like that. you just have to create the directories, if they don't already exist, and then save the file in them. I'm not sure what you meant by "put the database script in the upload script," but if you meant it literally, then of course there would be errors! post some code.
-
May 24th, 2009, 05:42 PM
#5
Fanatic Member
Re: Upload files and add to SQL?
When you upload the file, record the file's path into a database.
I would also name the file something like:
Test_Song_currenttimestamp.mp3 and save that file name into the database to avoid writing over your current files.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|