帮助上传多个mp3文件 [英] help uploading multiple mp3 file
本文介绍了帮助上传多个mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在线获取了此php代码,以将m3p文件加载到服务器上,并且运行良好,除了我希望能够通过添加更多文件上传框来一次上传多首歌曲.我已经尝试过,但是似乎无法正确处理,当我添加其他盒子时,我仍然只能听一首.我刚刚开始自己学习php,所以我还是新手.谢谢您的帮助.
这是html:
的形式
I got this php code online to load m3p files to my server, and it works good except I would like to be able to upload multiple songs at once by adding more file upload boxes. I have tried on my own but I cannot seem to get it right, when I add other boxes I still only get one track. I have just started to learn php on my own so I am still new to it all. Thank you for any help.
here is the form html:
<form action="/loadmp3.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="40" />
<br /><br />
<input type="submit" name="submit" value="Upload" />
<br /><br />
<span style="font-family: verdana; font-size: 12px;">* only mp3 files under 2 megabytes are allowed.</span>
</form>
这是php:
and this is the php:
<?php
if($_POST['submit']=="Upload") {
if ($_FILES['file']['name'] != "") {
if (($_FILES['file']['type'] == "audio/mpeg") || ($_FILES['file']['type'] == "application/force-download")) {
if ($_FILES["file"]["size"] < 16777216) {
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
echo "File has been stored in your uploads directory.";}
else { echo "Please upload a file that is under 2 mb!";}
} else {
echo "Please upload a mp3 file!";
exit;}
} else { echo "Please enter a file.";}
}
?>
推荐答案
_POST [ ' 提交'] == " ){ 如果(
_POST['submit']=="Upload") { if (
_FILES [' ' " ){ 如果(((
_FILES['file']['name'] != "") { if ((
_FILES [' 文件'] [ type'] == " )||(
_FILES['file']['type'] == "audio/mpeg") || (
这篇关于帮助上传多个mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文