Creation of the section “Listening” for the electronic textbook

The essence is this, there will be a section of the electronic textbook (on php + mysql). It has an audition section.
Those. there will be some kind of mp3 file with the voice of the announcer, you need to listen to it and complete tasks.
I presented it like this.
The page list should look like this:
alt text

Listening looks like this:
alt text

After some thought, I came up with this.

DB:

create table audio
(
id int primary key auto_increment,
title varchar(255) not null,
link varchar(255) not null
)

Where Linkis a link to the file after upload (i.e. uploaded file 1.mp3, it went to http://site.kz/uploads/1.mp3, so everything in bold will be in Link). I don’t know if I chose the right type.

Displayed on the main page via $result=select * from audio where id=$,

$row = mysql_fetch_array($result);
( $row['id']  $row['title'], $row['link'])

Next player (like http://www.ph4.ru/form_audionsite.ph4)

<object type="application/x-shockwave-flash" 
data="player/player.swf" id=audioplayer1 height=24 width=290>
<param name=movie value="player/player.swf"></param>
<param name=FlashVars 
value="playerID=1&soundFile='$row['link']' ">
</param>
<param name=quality value=high></param>
<param name=menu value=false></param>
<param name=wmode value=transparent></param>
</object>

Now a question.
How can I drag the full path to the file into a variable?
I press browse, select a file, then write TITLEand press add. The path must somehow be written to the database in link.


Answer 1, authority 100%

If I got the question right, something like this:
1) You make something like this form for uploading a file to the server:

<form action="add.php" method="POST" enctype="multipart/form-data">
  <input type="text" name="file_title">
  <input type="file" name="file_name">
  <input type="submit" value="">
</form>

2)On the handler page (for example, add.php) something like this:

<?php
if(empty($_POST["file"]) or empty($_POST["title"])){
  exit("    ");
}
if(is_uploaded_file($_FILES['file_name']['tmp_name'])){
  move_uploaded_file($_FILES["file_name"]["tmp_name"], "/uploads/".$_FILES["filename"]["name"]);
}
else { exit("    "); }
$file=("/uploads/".$_FILES["filename"]["name"]);
$title=$_POST['title'];
?>
<textarea>
<h3><?php print $title; ?></h3><br>
<object type="application/x-shockwave-flash" 
data="player/player.swf" id=audioplayer1 height=24 width=290>
<param name=movie value="player/player.swf"></param>
<param name=FlashVars 
value="playerID=1&soundFile=<?php print $file; ?>">
</param>
<param name=quality value=high></param>
<param name=menu value=false></param>
<param name=wmode value=transparent></param>
</object>
</textarea>

Well, if I didn’t get anywhere, then in the end you will be given a box in which there will be a code for the desired player.
There is still a trick with this player – id=audioplayer1with each new player id you need to add one (id=audioplayer2, id=audioplayer3…).

Small application:
$_FILES[‘uploadfile’][‘name’] – file name before it is sent to the server, for example, pict.gif;
$_FILES[‘uploadfile’][‘size’] – size of the received file in bytes;
$_FILES[‘uploadfile’][‘type’] – MIME type of the received file (if the browser could determine it), for example: image/gif, image/png, image/jpeg, text/html;
$_FILES[‘uploadfile’][‘tmp_name’] – contains the file name in the temporary directory, for example: /tmp/phpV3b3qY;
$_FILES[‘uploadfile’][‘error’] – An error code that may occur when uploading a file.