Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fileupload PHP.user.ini失败_Php_Jquery - Fatal编程技术网

Fileupload PHP.user.ini失败

Fileupload PHP.user.ini失败,php,jquery,Php,Jquery,我允许用户通过一个表单上传文件.mp4,该表单还可以向mysql发送一些信息 我将in.user.ini文件添加到存储.php文件的目录中,以提高该目录的上载限制 .user.ini upload_max_filesize 100M post_max_size 100M max_execution_time 1500 max_input_time 1500 opladen.php将信息发送到php文件的html页面 function functie1(){ //va

我允许用户通过一个表单上传文件.mp4,该表单还可以向mysql发送一些信息

我将in.user.ini文件添加到存储.php文件的目录中,以提高该目录的上载限制

.user.ini

upload_max_filesize 100M
post_max_size 100M
max_execution_time 1500
max_input_time 1500
opladen.php将信息发送到php文件的html页面

function functie1(){

             //var file = document.getElementById('fileupload').files[0];

             var xhr = new XMLHttpRequest();
             //xhr.file = file;
             xhr.addEventListener('progress',function(e){                                               
                    var done = e.position || e.loaded, total = e.totalSize || e.total;
                    var alupgeload = e.loaded / 1024;
                    alupgeload = alupgeload /1024;
                    var totalsize = e.total / 1024;
                    totalsize = totalsize / 1024;
                    alupgeload = alupgeload.toFixed(2)
                    totalsize = totalsize.toFixed(2);
                    var procent = Math.floor((alupgeload / totalsize * 100));

                    //document.getElementById("progressbar").value = (Math.floor(done/total*1000)/10);
                    $("#progresstekst").html(alupgeload + "MB/" + totalsize +"MB Procent:"+ procent+"%");
                    $("#uploadprogress").width((Math.floor(done/total*1000)/10)+'%');
                    console.log('xhr progresss: ' + (Math.floor(done/total*1000)/10) + '%');
                                                      },false);


             if ( xhr.upload ) {
                 xhr.upload.onprogress = function(e) {
                     var done = e.position || e.loaded, total = e.totalSize || e.total;
                     var alupgeload = e.loaded / 1024;
                    alupgeload = alupgeload /1024;
                    var totalsize = e.total / 1024;
                    totalsize = totalsize / 1024;
                    alupgeload = alupgeload.toFixed(2)
                    totalsize = totalsize.toFixed(2);
                    var procent = (alupgeload / totalsize * 100).toFixed(2);
                     $("#progresstekst").html(alupgeload + "MB/" + totalsize +"MB Procent:"+ procent+"%");
                     $("#uploadprogress").width((Math.floor(done/total*1000)/10)+ '%');
                     //document.getElementById("progressbar").value = (Math.floor(done/total*1000)/10);
                     console.log('xhr.upload progress: ' + done + '/' + total + ' = ' + ( Math.floor(done/total*1000)/10)+ '%');
                 };
             }


             xhr.onreadystatechange = function(e)
             {
                 if ( 4 == this.readyState ) {
                     console.log(['xhr upload complete',e]);
                 }
             };

             var fd = new FormData();

             var datum = document.getElementById('datepicker').value;
             var res = datum.split("/");

             var newdate = res[2] + "-" + res[0] + "-" + res[1];

             //var spelers =$("#spelers").select2("val");


             fd.append('titel', document.getElementById('titel').value);                                                          
             fd.append('beschrijving', document.getElementById('beschrijving').value);
             fd.append('type',document.getElementById('type').value);

             fd.append('datum',newdate);
             fd.append('tagsspelers',$("#spelers").select2("val"));
             fd.append('tagsteam',document.getElementById('teams').value);
             //fd.append('tagsclubs',document.getElementById('tags_clubs').value);
             //fd.append('tagswedstrijden',document.getElementById('tags_wedstrijden').value);
             fd.append('file',document.getElementById('fileupload').files[0]);

             xhr.open('post','./beeldbank/beheer/upload.php',true);
             xhr.send(fd);
         }
upload.php执行上载的php文件

session_start();
header("Content-Type: video/mp4");
include($_SERVER['DOCUMENT_ROOT'].'/sessionsetcookie.php');
// Alle variabelen opslaan //
$Titel = $_POST['titel'];
$Beschrijving = $_POST['beschrijving'];
$Type = $_POST['type'];
//$Subtype = $_POST['subtype'];
$Datum = $_POST['datum'];
//$Datum2 = date('Y-m-d',$Datum);
$Datum2 = date('Y-m-d',$Datum);
$Team = $_POST['tagsteam'];
$Tags_spelers = $_POST['tagsspelers'];
$Tags_clubs = $_POST['tagsclubs'];
$Tags_wedstrijden = $_POST['tagswedstrijden'];
$Lengte = 12 . ":" . 34;
$Uploadtijd =  date("Y-m-d H:i:s"); 
/////////// Explodes tags | Ofwel in php ofwel in javascript kan nog veranderen eig | Van string naar array omzetten
$Tags_spelers_array = explode(",",$Tags_spelers);
$Tags_clubs_array = explode(",",$Tags_clubs);
$Tags_wedstrijden_array = explode(",",$Tags_wedstrijden);
$usernaam = $_SESSION['username'];
$extension = end(explode('.', $_FILES['file']['name']));
$tmpName = $_FILES['file']['tmp_name'];

//// Counter berekenen voor het id van het filmpje te bepalen voor op de server teplaatsen
$counter2 = sql("db_connect","show table status like 'videos'");
$counter = mysql_fetch_row($counter2);
//$counter[10]; => Juiste veld is [10]
////////////////////
//// User id bij naam opvragen ///<br />
$userid = sql("db_connect","select id from users".$_SESSION['seizoen']. " where username = '".$usernaam."' ");
$useridd = mysql_fetch_row($userid);
//// Get video duration
$time =  exec("ffmpeg -i ". $tmpName . " 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//");   
$duration = explode(":",$time);   
$duration_in_seconds = $duration[0]*3600 + $duration[1]*60+ round($duration[2]);   

exec("HandBrakeCLI --preset 'iPhone & iPod Touch' --width 320 --vb 600 --two-pass --turbo --input " . $tmpName . " --output ". $_SERVER['DOCUMENT_ROOT']. "assets/video/" . $counter[10] . ".mp4 2>&1");
exec("ffmpeg -i " . $tmpName . " -s 640x320 -vcodec libtheora -acodec libvorbis " . $_SERVER['DOCUMENT_ROOT'] . "assets/video/".  $counter[10]  . ".ogg "); 
exec("ffmpeg -i " . $tmpName . " -vcodec libvpx -acodec libvorbis -target pal-vcd " . $_SERVER['DOCUMENT_ROOT'] . "assets/video/". $counter[10] . ".webm ");
////////////// Insert statement naar de "videos" tabel ( vroeger "beeldbank")
sql("db_connect","insert into videos(`titel`,`beschrijving`,`extensie`,`lengte_seconden`,`video_datetime`,`upload_user`,`upload_datetime`)
                    VALUES ('" . $Titel . "','" . $Beschrijving . "','" . $extension . "','" . $duration_in_seconds . "','" . $Datum . "','" . $useridd[0] . "','" . $Uploadtijd . "')");
//////////////////////// insert statement naar de bbt_spelers tabel //////
foreach ($Tags_spelers_array as $user)
{

    $user2 = explode(" ",$user);
    $string ="";
    foreach ($user2 as $i)
    {

    $string .= $i;
    }
    $sql_userid = sql("db_connect","select id from users".$_SESSION['seizoen']." where username ='" .$string. "'");
    $result = mysql_fetch_row($sql_userid); 
    sql("db_connect","insert into bbt_spelers(`video_id`,`speler_id`) VALUES (".$counter[10]. ",". $result[0].")");
}
////// insert statement naat de vide_videotypes tabel
/// eerst ids van de types ophalen

$sql_typeid = sql("db_connect","select id from videotypes where naam = '" . $Type . "'");
$typeid = mysql_fetch_row($sql_typeid); 
sql("db_connect","insert into video_videotypes(`video_id`,`videotype_id`) values ('" . $counter[10] . "','" . $typeid[0] . "')");
echo $Team;

/// Insert into bbt_teams
if ( $Team)
{
sql('db_connect',"insert into bbt_teams ( `video_id`,`team_id`) values ('".$counter[10] . "','" . $Team."')");
}
这一切都适用于1MB左右的小文件。我需要它处理更大的文件。我两天来一直在努力解决50MB的问题。有什么建议吗?
现在的问题:转换没有发生,mysql中的行是空的,但确实添加了

您的.user.ini文件中是否缺少每个=符号?我认为phpinfo中根本没有显示这些值,是吗?您应该检查$\u文件数组中的错误。最大执行时间足够长吗?