Home > Backend Development > PHP Tutorial > ajaxFileUpload 上传不了文件,该如何处理

ajaxFileUpload 上传不了文件,该如何处理

WBOY
Release: 2016-06-13 11:55:17
Original
1316 people have browsed it

ajaxFileUpload 上传不了文件
代码如下:
function ajaxFileUpload()
{      
  $.ajaxFileUpload(
  {
       url:"action.php?do=uploadapk",//用于文件上传的服务器端文件
       secureuri:false,//一般设置为false
       fileElementId:'uploadapk',//文件上传空间的id属性  
       dataType: 'text',//返回值类型
       success: function(data){//服务器成功响应处理函数
        window.location.href="up_apk.php"; 
       }
  }    
  );               
  return false;
}
后台 :
if(empty($_FILES['uploadapk']['tmp_name']) || $_FILES['uploadapk']['tmp_name'] == 'none')
      {
      $error = 'No file was uploaded..';
      }else
      {
     
      $apk_location = './uploads/'.$_SESSION['U_Username'].'/'.time().".apk";     //定义上传后的位置和新文件名
     
      if (is_uploaded_file($_FILES['uploadapk']['tmp_name'])) {     //判断是否为上传文件
      if (!move_uploaded_file($_FILES['uploadapk']['tmp_name'], $apk_location)) {   //从移动文件
      echo '问题: 不能将文件移动到指定目录。';
      exit;
      }

      }
      }
      echo json_encode($res);

只能上传1MB以内的文件,上传不了1MB以上的文件!请问如何修改啊?PHP,INI已经设置最大POST是15MB了

------解决方案--------------------
php.ini
upload_max_filesize = 100M; 最大文件尺寸
post_max_size  = 128M; 表单容量应不小于上传文件

另外保证 memory_limit 至少是 post_max_size 的 2 倍
------解决方案--------------------
看下php.ini参数

upload_max_filesize
post_max_size

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template