내 PHP 웹 사이트를 통해 mp3 파일을 업로드하는 데 문제가 있습니다. 그것은 당신이 2MB 미만의 모든 것을로드 할 수있게 해줄뿐입니다. 우리는 또한 FastCGI를 제한 시간 제한을 증가하고를 추가 한 php_value로의 max_execution_time을 300PHP를 통해 MP3 파일 업로드
: 그것은 이전
일했다 호스팅 제공 업체는 다음과 같은 도메인 디렉토리에 있습니다 htaccess로 파일 된 FastCGI 시간 제한을 증가 추가했습니다 htaccess로 파일 : php_value로의이 upload_max_filesize의 20M
이 사이트가 파일 형식을 지원하지 말 돌아올 php_value로의 post_max_size을의 20M.
다음 코드 중 일부를 참조하십시오. 모든 도움을 미리 감사드립니다.
//ende wenn audio gelàscht werden soll
// audio wird hochgeladen
if($_GET["add"] == "audio"){
if (empty($_POST["audioRelease"])) {
header("Location: ../media.php?uperror=Please upload a Showcase in My Showcase page first!");
die();
}
// var die gesetzt werden
//check ob mit upload file die grenze erreicht ist
$sqlArtist = "SELECT *";
$sqlArtist .= " FROM zap_artist INNER JOIN zap_user ON zap_artist.userID = zap_user.userID ";
$sqlArtist .= " WHERE ";
$sqlArtist .= " zap_artist.userID = " . $_SESSION["userID"];
$rsArtist = mysql_query($sqlArtist);
$crArtist = mysql_fetch_assoc($rsArtist);
$account = $crArtist["account"];
if ($account == 1){
$mySpace = "0";
}else
if ($account == 2){
$mySpace = "20";
}else
if ($account == 3){
$mySpace = "40";
}else
if ($account == 5){
$mySpace = "10";
}else
if ($account == 6){
$mySpace = "40";
}else
if ($account == 7){
$mySpace = "80";
}
//errechne wieviel platz auf dem server ist
$sqlAudioSpace = "SELECT *";
$sqlAudioSpace .= " FROM zap_audio";
$sqlAudioSpace .= " WHERE ";
$sqlAudioSpace .= " artistID = " . $artistID;
$rsAudioSpace = mysql_query($sqlAudioSpace);
$anAudioSpace = mysql_num_rows($rsAudioSpace);
while($crAudioSpace = mysql_fetch_assoc($rsAudioSpace)){
$auSize = $crAudioSpace["audioSize"];
$numGesamt += $crAudioSpace["audioSize"];
}
$auGesamtSize = $numGesamt + $audioName_size;
//$auGesamtSize = bcdiv($numGesamt, 1000000, 2);
$auReal = $auGesamtSize/1000000;
$auRealGesamt = round ($auReal, 2);
if ($auRealGesamt > $mySpace){
header("Location: ../media.php?uperror=File is too large!");
die();
}else{
//ende errechne ob file uploaded werden darf
//$audioName = "audioName";
$maxSize = 1000 * 12000;
$audioUploadPath = "../../hluistm4nbt2elsOq/";
// ende vars die gesetzt werden
// get the right filetype
$fileType = $audioName_type;
//the file type will be like'image/jpeg'
$fileTypePieces = explode("/" , $fileType);
//$imageType will be 'jpeg'
$imageType = $fileTypePieces[1];
if($imageType == "mpeg"){
$theFileType = "mp3";
}
else if($imageType == "mp3"){
$theFileType = "mp3";
}
else if($imageType == "MP3"){
$theFileType = "mp3";
}
else{ //if it is a filetype we do not want to support
$theFileType = "";
}
// end get the right file type
//
//check to see if the users actually chose an image
if($audioName_name != ""){
if($audioName_size > $maxSize){
header("Location: ../media.php?uperror=File is too large!");
die();
}else{//if the image is within our limits
//test to see if the image is NOT of a supported type
if($theFileType == ""){
header("Location: ../media.php?uperror=Filetype not supported!");
die();
}else{
list($ar,$aID) = explode("__",$_POST["audioRelease"]);
//echo $ar . $aID;
//exit;
//insert the new image into the database
$sqlInsertImage = "INSERT INTO zap_audio(releaseID, audioRelease, audioInfo, audioName, audioFileName, audioSize, audioType, artistID)";
$sqlInsertImage .= "VALUES('".$aID."' , '".$ar."' , '".$_POST["audioInfo"]."' , '".$_POST["audioSongName"]."' , '$audioName_name' , '$audioName_size' , '$audioName_type' , '$artistID')";
$insertImage = mysql_query($sqlInsertImage);
//get the inserted image ID
$audioID = mysql_insert_id();
//change the name of the file to be unique
$audioNameNew = $audioID.".".$theFileType; //example : 4.mp3
$filePath = $audioUploadPath . $audioNameNew ;
//update the images table to put the file path back in
$sqlUpdate = "UPDATE zap_audio SET audioPath = '" .$filePath . "' , audioFile = '" .$audioNameNew . "'WHERE audioID = " . $audioID ;
$exec = mysql_query($sqlUpdate);
아니요. 사이트는 한동안 잠복 해 있었다. – user3480515
@ user3480515 - 언급 한 오류가 [JPG, png 및 gif와 매우 유사하게 보입니다. joomla 3.2.1]에서이 파일 유형이 지원되지 않습니다. http://stackoverflow.com/questions/20723154/jpg-png -gif-this-file-type-is-joomla-3-2-1에서 지원되지 않습니다. – blue