I have made an API for upload songs but it is creating problem. When I have upload a song through my android device, it is uploading in my Songs folder on Ubuntu but this song is not playing. Please give me the solution?
My code is this:
<?php
include('connect.php');
header("Content-type: text/xml");
$target_path = "./Songs/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "The file ".'"'. basename( $_FILES['uploadedfile']['name']) .'"'." has been uploaded";
chmod ("Songs/".basename( $_FILES['uploadedfile']['name']), 0644);
}
else
{
echo "There was an error uploading the file, please try again!";
echo "filename: " . basename( $_FILES['uploadedfile']['name']);
echo "target_path: " .$target_path;
}
?>
I have done it and it’s working fine.