2016-12-29 29 views
-1
$mimg=strtolower(substr($_FILES['video1']['name'], strrpos($_FILES['video1']['name'], '.') + 1)); 
$ext = $lastid.".".$mimg; 

$target_dir = "wp-content/plugins/videos/includes/uploads/".$ext; 

$ss=move_uploaded_file($_FILES["video1"]["tmp_name"], $target_dir); 

$imageFileType = pathinfo($target_dir,PATHINFO_EXTENSION); 
//$ex = $lastid.".".$imageFileType; 

if($imageFileType != "mp4" && $imageFileType != "avi" && $imageFileType != "mov" && $imageFileType != "3gp" && $imageFileType != "mkv") 
{ 
    echo "File Format Not Suppoted"; 
} 
else 
{ 
    if($ss){ 
    $update2=$wpdb->query("update wp_videos set video1='".$ext."' where id='".$lastid."'"); 
     if($update2) 
     echo "uploaded "; 
    } 
} 
+0

通過增加服務器中的上傳大小。搜索如何在php中增加上傳大小。 –

+0

目前還不清楚你實際問了什麼,對不起。很明顯,系統中可能的文件上傳大小受到php的限制,但這些設置都有文檔記錄,你應該沒有問題學習如何改變它。那麼你的問題在這裏呢? – arkascha

+0

你面臨什麼樣的問題?有沒有錯誤信息? –

回答

0

你可以做到以下幾點:

ini_set('upload_max_filesize', '15M'); 
ini_set('post_max_size', '15M'); 
+0

當我上傳14mb視頻,我得到了一個錯誤 –

+0

警告:POST內容 - 14655593字節的長度超過了第0行的未知8388608字節的限制。 –

+0

我添加了第二行。試試吧。 –

0

你需要設置的upload_max_filesizepost_max_size值在php.ini

upload_max_filesize = 15M 

post_max_size = 15M 

你需要重新啓動服務器才能使用新的配置。

如果你不能改變你的php.ini,那你的運氣不好。您不能在運行時更改這些值;文件比在php.ini指定的值的上傳將被執行一次都未能達到您到ini_set()

+0

我已在php.ini中更改,但無法在服務器中更新 –

+0

重新啓動您的服務器... –

+0

感謝信息 –

0

您需要設置的upload_max_filesize和post_max_size要的價值在php.ini或電話的.htaccess:

; Maximum allowed size for uploaded files. 
upload_max_filesize = 40M 

; Must be greater than or equal to upload_max_filesize 
post_max_size = 40M 
0
Simply add this code in your theme’s functions.php file. 
@ini_set('upload_max_size' , '64M'); 
@ini_set('post_max_size', '64M'); 
@ini_set('max_execution_time', '300'); 
This code tries to increase upload maximum filesize, post maxiumum size, and maximum execution time limits for your WordPress site. However, this may not work for some WordPress websites. 
In that case, you can try adding this code to your .htaccess file in your site’s root folder. 
php_value upload_max_filesize 64M 
php_value post_max_size 64M 
php_value max_execution_time 300 
php_value max_input_time 300 

If both of these methods fail, then you can try adjusting these values using php.ini file. 

Ref: http://www.wpbeginner.com/beginners-guide/how-to-upload-large-images-in-wordpress/