You are here: MP3 upload problem « PHP Programming Language « IT news, forums, messages
MP3 upload problem

Posted by mpar612 on 09/08/06 12:59

Hi everyone,

I am relatively new to PHP and am having a bit of a problem with
uploading MP3's with a form.

I am creating a new directory, which does get created and I am trying
to upload an mp3 to that directory. With the code below I constantly
get "Please use an mpeg." If I strip away everything that limits the
filetypes and will simply upload any file, I get "file upload failed."

I did a print $audio_name and print $audio_uploaddir and the name and
directory print out properly, but the file does not get moved to the
directory.

On this page I also have a similar piece of code that uploads an image
and that works perfectly. I did delete that in case there could have
been some sort of conflict, but I get the same errors that I mentioned
above.

Does anyone have any thoughts? Any help would be greatly appreciated.
Thanks!

Here is the snippet of code:

$audio_dir_new = $_POST[upc];
mkdir("../Lounge/audio/$audio_dir_new", 0777);

$filetypes = array ('audio/mpeg');
if (in_array($_FILES['upfile']['type'], $filetypes)){
$audio_name = $_FILES['song1']['name'];
$audio_uploaddir = "../Lounge/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";
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация