dsmnedc798226 2014-02-12 18:27
浏览 66
已采纳

无法在我的php脚本上传mp3文件

I have a script in php and i'm trying to upload audio files with it, and later i want to use it to upload video files as well but it doesn't let me do that. I changed upload_max_filesize = 2000M just to be sure but it's still not working.

here is my script:

><?php

>if (isset($_FILES["file"]))

>{

>   echo "<p>"."Upload: " . $_FILES["file"]["name"] ."</p>". "<br>";

>   echo "Type: " . $_FILES["file"]["type"] . "<br>";

>   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";

>   echo "Stored in: " . $_FILES["file"]["tmp_name"];


>   $uploaddir = '../audio/';

>   $file = basename($_FILES['file']['name']);

>   $uploadfile = $uploaddir . $file;
>   
>   print_r($_FILES);
>
>   if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) 

>   {

>       echo "it's mine!";

>   }

>   else

>   {

>       echo "sh*t!";

>   }

>}

>?>

what can i do? I also checked juploade but i can't find any documentation on how to use it.

also, if i try to upload txt or other small files it works.

  • 写回答

1条回答 默认 最新

  • dongshungou7699 2014-02-12 18:41
    关注

    pls replcae this :

    if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)
    with : 
    if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile.$_FILES["file"]["name"])) 
    

    try changing this on php.ini

    memory_limit = 99M
    max_execution_time = 300
    upload_max_filesize = 20M
    post_max_size = 24M
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据