Guten Tag,
ich möchte eine 15MB große PDF datei hochladen. Doch wenn ich das Formular absende kommen keine Post daten im PHP skript an. Mit einer 2MB pdf funktionierts einwandfrei
php.ini:
upload_max_filesize = 50M
post_max_size = 80M
file.php:
print_r($_POST);
print_r($_FILES);
Ausgabe:
Array ( ) Array ( )
ich möchte eine 15MB große PDF datei hochladen. Doch wenn ich das Formular absende kommen keine Post daten im PHP skript an. Mit einer 2MB pdf funktionierts einwandfrei
php.ini:
upload_max_filesize = 50M
post_max_size = 80M
file.php:
print_r($_POST);
print_r($_FILES);
Ausgabe:
Array ( ) Array ( )
PHP-Code:
...
<?php
function insertForm(){
setlocale(LC_TIME, 'de_DE');
$this->setLinkParameter("journalInsertStep", 1);
$this->setLinkParameter("journalAction", "insertForm");
$this->setLinkParameter("sendJournalData", "1");
?>
<form method="post" action="<?php echo $this->getLink(); ?>" enctype="multipart/form-data">
Ausgabe Titel:
<input type="text" name="journalTitle" /><br>
Ausgabe Datum:
<select name="year">
<option><?php echo date("Y"); ?></option>
<option><?php echo date("Y")+1; ?></option>
</select>
<select name="month">
<option value="<?php echo date("m"); ?>"><?php echo strftime("%B"); ?></option>
<option value="<?php echo date("m")+1; ?>"><?php echo strftime("%B", mktime(0, 0, 0, date("m")+1, date("d"), date("Y"))); ?></option>
<option value="<?php echo date("m")+2; ?>"><?php echo strftime("%B", mktime(0, 0, 0, date("m")+2, date("d"), date("Y"))); ?></option>
</select><br />
Heft im PDF Format: <br />
<input type="file" name="journalPdf" accept="application/pdf"><br />
<input type="submit" name="sendJournalData" value="Schritt 2">
</form>
<?php return false;
}
...
function insert(){
print_r($_POST);
print_r($_FILES);
if ( $_FILES["journalPdf"]["type"] == "application/pdf" && $_FILES["journalPdf"]["size"] < 1024*1024*50)
{
if ($_FILES["journalPdf"]["error"] > 0)
{
echo "Es trat ein Fehler auf: " . $_FILES["journalPdf"]["error"] . "<br />";
}else{
if (file_exists("../journals/upload/" . $_FILES["journalPdf"]["name"])){
$_FILES["journalPdf"]["name"] = $this->checkJournalUploadFileExist($_FILES["journalPdf"]["name"]);
echo "Die Datei existiert schon auf dem Server der Dateiname wurde Ingrementiert,<br> der neue Dateiname ist jetzt: ".$_FILES["journalPdf"]["name"] ;
}
echo 1;
move_uploaded_file($_FILES["journalPdf"]["tmp_name"],"../journals/upload/" . $_FILES["journalPdf"]["name"]) OR die("can't move file");
$journalFileName= explode(".", $_FILES["journalPdf"]["name"]);
unset($journalFileName[count($journalFileName)-1]);
$journalFileName = join(".", $journalFileName);
if(!is_dir("../journals/".$_POST['year']."/".$_POST['month']."/".$journalFileName))
mkdir("../journals/".$_POST['year']."/".$_POST['month']."/".$journalFileName,0777,true);
exec("convert '../journals/upload/" . $_FILES["journalPdf"]["name"]."' -colorspace RGB -density 300 -quality 100 ../journals/".$_POST['year']."/".$_POST['month']."/".$journalFileName."/".$journalFileName.".jpg");
$query = "INSERT INTO journals(journalYear,journalMonth,journalFile,journalTitle)VALUES('".$_POST['year']."','".$_POST['month']."','".$journalFileName."','".$_POST['journalTitle']."')";
mysql_query($query,$this->connection) OR die(mysql_error($this->connection));
}
}else{
echo "Die Datei ist zu groß oder ist keine PDF Datei.";
}
}
...
case "insertForm":
if(isset($_GET['journalInsertStep'])){
switch($_GET['journalInsertStep']){
case "1":
if(isset($_GET['sendJournalData']))
$this->insert();
$contents = new contents();
$contents->mysqlSiud($this->connection);
$contents->siteMysqlSiud("index.php");
$contents->setLinkParameter("journalInsertStep", 1);
$contents->setLinkParameter("journalAction", "insertForm");
if($contents->insertForm(mysql_insert_id($this->connection)))
break;
case "2":
echo "Das Heft wurde erfolgreich online Veröffentlicht.";
return true;
break;
default:
echo "Leider trat beim Erstellen des neuen Eintrags ein Fehler auf.";
break;
}
}else{
$this->insertForm();
}
break;

Kommentar