uploading problem
Posted: Wed Dec 06, 2006 2:39 am
i got a code to upload picture i triad it to upload music but is not wokring is there a special way or music than picture?
Code: Select all
<form action="../phpscripts/muls.php" method="post" enctype="multipart/form-data" name="ulmusic" id="ulmusic">
<table border="0">
<tr>
<td>song_name</td>
<td><label>
<input name="song" type="text" id="song" />
</label></td>
</tr>
<tr>
<td><label>song:</label></td>
<td><input name="sfile" type="file" id="ulfile" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="UpLoad" /></td>
</tr>
</table>
</form>Code: Select all
include_once'../includes/db.php';
//get variable
$song=$_POST['song'];
$dir='../music/hmp/';
$filesize = $_FILES['sfile']['size'];
$filetype = $_FILES['sfile']['type'];
$filename = $_FILES['sfile']['name'];
$tmpname = $_FILES['sfile']['tmp_name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;
$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}