proggybilly
Programmer
I am trying to do a page which will upload a file to the server, I have already check the max_file_size and post_max_size.. Both are set to 200MB.
The errors I get are:
Notice: Undefined index: tempcmdlog.log in /var/ on line 12
/var/lib/asterisk/sounds/custom/
Notice: Undefined index: tempcmdlog.log in /var/ on line 15
There was an error uploading the file, please try again!
here is my code (maybe someone here can figure what I am doing wrong)
The errors I get are:
Notice: Undefined index: tempcmdlog.log in /var/ on line 12
/var/lib/asterisk/sounds/custom/
Notice: Undefined index: tempcmdlog.log in /var/ on line 15
There was an error uploading the file, please try again!
here is my code (maybe someone here can figure what I am doing wrong)
Code:
<?php
$filename = $_POST['datafile'];
function uploadFile($filename){
$target_path = '/var/lib/asterisk/sounds/custom/';
$target_path = $target_path . basename( $_FILES[$filename]['name']);
echo $target_path;
if(move_uploaded_file($_FILES[$filename]['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES[$filename]['name']).
" has been uploaded";
$query = "insert into files(path) values('$target_path')";
$result = mysql_query($query);
} else {
echo "There was an error uploading the file, please try again!";
}
}
if($_POST['submit']){
uploadFile($filename);
}
?>
<html>
<head>
<title>IVR UPLOAD NEW SOUND FILE</title>
</head>
<body>
<?php require('header.php') ?>
<form method="post" action="upload.php">
<table align="center">
<tr>
<td>Please choose the file you wish to upload:<br>
<input type="file" name="datafile">
</td>
</tr>
<tr><td><input type="submit" name="submit" value="Upload"></td></tr>
</table>
</form>
</body>
</html>