0

这是我的 form.php

      <form name="form" action="upload.php" method="post" enctype="multipart/form-data">
                <?php $id=$_REQUEST['id1']; ?>
        <label>Category: </label><?php echo
        '<input type="text" name="category" onfocus="blur()" value='.$id.'>'?></br>
            <label>Name:</label>
            <input type="text" name="name" size="32"></br></br>
            <label>Type:</label>
            <select name="type">
                <option value="Audio">Audio</option>
                <option value="Video">Video</option>
                <option value="Read">Read</option>
                <option value="Quiz">Quiz</option>
            </select>
            <label>Description:</label></br>
            <textarea rows="10" cols="30" name="description"></textarea></br>                  </br>
            <label>File:</label>
            <input type="file" name="files"/></br>
            <input type="submit" value="upload" name="up">
        </form>

和我的upload.php

        include("connect.php");


        if(isset($_REQUEST['up']))
        {
        $nagan=$_FILES['files']['name'];    
        $tmp_loc=$_FILES['files']['tmp_name'];

         echo $nagan;
         echo $tmp_loc;
            $bookCover="modules/".$nagan;

            move_uploaded_file($tmp_loc,$bookCover);

            $sql="INSERT INTO modules (name, type, description, filename, category)VALUES('$_POST[name]','$_POST[type]','$_POST[description]','$bookCover','$_POST[category]')";

           mysql_query($sql);

    $count=mysql_affected_rows();

    if($count==1)
    {

      echo "File $nagan Successfully Uploaded!";

    }else
      echo "Error!";


      }

    ?>

上传图像和 pdf 文件工作正常,但是当我尝试上传音频文件时,它不会显示在指定的文件夹(模块文件夹)中,但它会在数据库中保存一个值。此外,当我尝试上传视频文件时,upload.php 根本不起作用。请帮我。我想弄清楚这两天了。帮助。

4

3 回答 3

0

upload_max_filesize你的和post_max_size的价值是什么php.ini?您尝试上传的音频文件的大小是多少?

  print ini_get('upload_max_filesize').' MBytes (Upload max size) <br/>'.
        ini_get('post_max_size').' MBytes (Post Max Size)'; 

这两个以 MBbytes 为单位显示结果。如果这个太小,

1) Try: ini_set('upload_max_filesize','the size you need');
        ini_set('post_max_size','the size you need');
2) If the 1) does not works : 
  try to set the value of this properties in your php.ini  
      (on linux use this command to find: locate php.ini, or find / -name php.ini)
      (on windows use the file search tool)
  restart apache /if you use apache/ or the webserver deamon what you use
3) If you could not do 1) or 2)  (because do not have access this property) contact to the server administrator.

而在这些都尝试上传小(小于1MB)的音频和视频文件之前。

于 2013-03-30T11:38:36.140 回答
0

以下选项是相关的:

PHP: upload_max_filesize (in php.ini or .htaccess only, won't work using ini_set())

PHP: post_max_size

PHP: max_input_time

and possibly

Apache: LimitRequestBody

于 2013-03-30T11:38:37.053 回答
0

There may be permission problem in php.ini for max upload size.

upload_max_filesize = 10M

; Must be greater than or equal to upload_max_filesize

post_max_size = 10M

You can change it too, and restart the server.

于 2013-03-30T11:41:31.527 回答