0
Ich habe einen Datei-Upload in PHP erstellt. Die maximale Dateigröße beträgt 5 MB. Ich versuche eine Datei hochzuladen, die 39 MB groß ist.Datei-Upload funktioniert nicht richtig in PHP
Der Datei-Upload funktioniert für alle Dateien, die 5 MB oder weniger als 5 MB sind, funktioniert sogar gut mit 30 MB-Datei und die Rückkehr FEHLER: Max Dateigröße Grenze überschreitet. Aber nur in diesem Fall 39MB gibt es den unteren Fehler zurück.
**action.php**
<form class="w3-container " action='file_upload.php' method='post' enctype="multipart/form-data" name="form" id="form-e" role="form">
<DIV id="file_name_div">
<label for="file_name">Enter file name: </label><br>
<input data-validation="filename" autocomplete="off" style="width:30%" class="w3-input w3-border w3-light-grey " type="text" name='file_name' id='file_name' autofocus />
<label for="Role">Enter Role: </label><br>
<input data-validation="role" style="width:30%" class="w3-input w3-border w3-light-grey " type="text" name='role' id='role' autofocus />
</DIV>
<br>
<button type="reset" class="btn btn-info btn-md w3-blue"><span class="glyphicon glyphicon-refresh"></span> Reset</button>
</form>
****file_upload.php****
<?php
session_start();
include_once 'config.php';
$message = '';
$fileName = $_POST['file_name']; //LINE NO 6
$role = $_POST['role']; #role code //LINE NO 7
$dir= "files/$role/"; #uploading file to selected role
foreach ($_FILES as $filename => $filearray) {
if (is_uploaded_file($filearray['tmp_name'])) {
$fileLogicalName = $filearray['name'];
$fileSize = (int) ($filearray['size']/1024);
$filePhysicalName = pathinfo("$fileLogicalName"); //Return complete file name with extension
$filePhysicalName['filename']; //The arrray of pathinfo return only file name without extension
if ($fileSize <= 5120) // 5mb/1024
{
//file upload code
}
}
}
?>