PDA

View Full Version : upload mp3 file and info into database how??


cedtech23
08-22-2004, 01:07 AM
I decided to create a directory on my server to store the mp3 files instead and then to store the files path in the mysql

so I would first create the table like this


$sql = CREATE TABLE mp3_files (
id int NOT NULL AUTO_INCREMENT Primary Key,
Song Name VARCHAR,
Artist Artist VARCHAR ,
Release_Date date,
Additional Notes VARCHAR,
Path ?? );


where "Path" would it me VARCHAR type?? and how would I store the absolute path of the file using PHP

Lets say I had a folder called MP3_Files on my server that would contain all my mp3 files and I uploaded an mp3 song called big poppa? How would I store this location so that when I go to retrieve this file it know the exact one?? :eek:

cedtech23
08-22-2004, 02:57 AM
I made some changed to make it easier I create the directory on my server called mp3_files I am using the htm form and php script to move the mp3 files to that location. I am lost in using the move_uploaded_file function to move the file to that directory?

can someone take a look at my script and twll me what ??? should be
move_uploaded_file(???,"$folder\???" );


<?php

if ($action == "load") {

$folder = "mp3_files";
move_uploaded_file(???,"$folder" );

}


?>

<html>
<head>
<title></title>
</head>
<body>
<table>
<form action="upload.php" method="post" enctype="multipart/form-data">

<tr><td><b>MP3 Info:</b></td></tr>
<tr><td>Song Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Artist: </td><td><input type="text" name="artist"></td></tr>
<tr><td>Release Date: </td><td> <input type="text" name="release_date"></td></tr>
<tr><td>Additional Notes</td></tr>
<tr><td></td><td><TEXTAREA NAME="note" COLS=40 ROWS=6></TEXTAREA></td></tr>
<tr><td>Select a File to Upload:</td>
<td><input type="file" name="mp3_file">
<input type="Submit" name=action value="Load"></td></tr>
</form>
</table>
</body>
</html>