2013-08-08 2 views
1

ID3 태그로 데이터에 태그를 지정하는 업로드 스크립트에서 지금 작업하고 있습니다. 지금이 시점에서 , 나는 10메가바이트 작은 파일 3메가바이트을 업로드 할 수 있지만 더 큰 85M 같은 파일을 업로드 할 경우, 그것은 더 이상 작동하지 않으며 나에게 빈 배열 다른에디버깅 중에 파일 업로드가 빈 배열을 반환합니다.

Array() Array()

을 반환 측면에서, 나는 150M까지 업로드를 허용하도록 PHP 런타임을 구성했습니다. 다음은 내가 틀릴 수도 모르는 내 코드

<?php 

// Starting session 
session_start(); 

error_reporting(E_ALL); 

//// loading configuration 
require_once '../lib/config.php'; 

require_once '../vendor/autoload.php'; 
print_r($_POST); 
print_r($_FILES); 
if ((isset($_POST)) && (!isset($_SESSION['AIRTIME_3RDPARTY_UPLOADER']))) { 

    // Post variables 
    $date = $_POST['date']; 
    $show = $_POST['show']; 
    $presenter = $_POST['presenter']; 
    $desc = $_POST['description']; 
    $file = $_FILES['files']; 


    date_default_timezone_set('Europe/Berlin'); 



// config for file handling (where to put) 
    $upload_dir = $config['airtime']['upload']; 
    $baseFilename = basename($file['name']); 
    $explodeName = explode(".", $baseFilename); 
    $newName = $explodeName[0] . "-" . date('dMY') . "-" . uniqid(); 

    $finalName = $newName . "." . $explodeName[1]; 
    $upload = $upload_dir . $finalName; 

    $getFileSize = ($file['size']/1024)/1024; 


    if ($getFileSize > $config['airtime']['upload_size']) { 
     print('Your file is to big for this system'); 
    } 

// only allowing the filetpyes within the array 
    $allowed_filtypes = array('audio/mp3', 'audio/ogg', 'audio/vnd.wave', 'audio/mp4'); 

// Check if there is any error with uploading the file 
    if ($file["error"] > 0) { 
     print_r($file); 
    } else { 
     if (in_array($file['type'], $allowed_filtypes)) { 

// Initialize getID3 tag-writing module 
      $tagwriter = new getid3_writetags(); 

//$tagwriter->filename = '/path/to/file.mp3'; 
      $tagwriter->filename = $file['tmp_name']; 
      $tagwriter->tagformats = array('id3v1', 'id3v2.3'); 

// set various options (optional) 
      $tagwriter->overwrite_tags = true; 
      $tagwriter->tag_encoding = $TaggingFormat; 
      $tagwriter->remove_other_tags = true; 

// Populating Data Array 
      $TagData = array(
       'title' => array($show . "-" . $date), 
       'artist' => array($presenter), 
       'year' => array(date('Y')), 
       'genre' => array('Radioshow'), 
       'comment' => array($desc) 
      ); 

// assigning Data to Variable 
      $tagwriter->tag_data = $TagData; 

// write tags 
      $tagwriter->WriteTags(); 

// Moving file to repo 
      move_uploaded_file($file['tmp_name'], $upload); 

//header 
      header('Location: submit_success.php'); 
     } else { 
      header('Location: submit_fail.php'); 
     } 
    } 
} else { 
    print('Wrong form key'); 
} 
?> 

입니다 .. 어떤 도움이

+0

업로드가 성공했다고 가정합니다. 'var_dump ($ _ FILES [ 'files'] [ 'error'])'무엇입니까? 절대 ** 절대 성공을 거두지 마라. 항상 실패를 확인하고 즐거운 놀라움으로 성공을 대하십시오. –

답변

3

당신이 post_max_size을 증가하는 것을 잊었다 것 같은데 감사, upload_max_filesize하지 충분히 post_max_size 기본값이기 때문에 일반적으로 증가 보통 비교적 작다. 이 제한보다 큰 파일을 업로드 할 때

http://www.php.net/manual/en/ini.core.php#ini.post-max-size

, 다음 $_POST$_FILES는 비어 있습니다.

+0

지적 해 주셔서 감사합니다. 결국 더 큰 파일을 업로드하는 데 도움이되었습니다! – cbuchler

관련 문제