Thanks for your help!!!
After a few days of ripping my hair out and talking to my isp, this issue is not with the folder permissions but with mime types.
I am trying to take an mp3 that a user uploads via a form and transfer it to a new directory. For security purposes, I would like to limit the types of files uploaded strictly to mp3's. I have no idea why this won't work.
Could I be missing out on some mime types? Could someone recommend another way to do this?
Thanks!
They following code uploads the file, but will not move it to the specified directory.
$filetypes = array ('audio/mpeg');
if (in_array($_FILES['song1']['type'], $filetypes)){
$audio_name = $_FILES['song1']['name'];
$audio_uploaddir = "../audio/$audio_dir_new/";
if (move_uploaded_file($_FILES['song1']['tmp_name'], $audio_uploaddir.'/'.$audio_name)) {
print("file upload was successful");
} else {
print("file upload failed");
}
} else {
print "Please use an mpeg";
}
Now, if I strip off trying to limit the type of file uploaded using the following code, everything works.
$_FILES['song1']['type'];
$audio_name = $_FILES['song1']['name'];
$audio_uploaddir = "../audio/$audio_dir_new/";
if (move_uploaded_file($_FILES['song1']['tmp_name'], $audio_uploaddir.'/'.$audio_name)) {
print("file upload was successful");
} else {
print("file upload failed");
}