ich diesen Code für das Hochladen in meiner zf Anwendung:konnte nicht irgend etwas anderes als jpg laden
public function uploadAction() {
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("uploads");
if (!$upload->isValid()) {
throw new Zend_Exception("Upload Error");
}
try {
$upload->receive();
} catch (Zend_File_Transfer_Exception $e) {
throw new Zend_Exception('Upload Error ' . $e->getMessage());
}
$this->_helper->viewRenderer->setNoRender();
}
und folgende html:
<form enctype="multipart/form-data" action="admin/upload" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="Filedata" type="file" /><br />
<input type='hidden' name='MAX_FILE_SIZE' value='10000' />
<input type="submit" value="Upload File" />
</form>
alles funktioniert mit jpg-Dateien in Ordnung ... aber i bekam zend Ausnahme auf JPG und pNG und ... etc:
Fatal error: Uncaught exception 'Zend_Exception' with message 'Upload Error' in D:\xampp\htdocs\sc\application\controllers\AdminController.php on line 2539 (!) Zend_Exception: Upload Error in D:\xampp\htdocs\sc\application\controllers\AdminController.php on line 2539
i die Ausnahme und var-Dump-Validator Nachricht ausgetestet ... f ound dies:
array
'fileUploadErrorFormSize' => string 'File 'Filedata' exceeds the defined form size' (length=45)
'Datei Filedata 'überschreitet die definierte Formulargröße Überprüfen Sie Ihre php.ini für max_post_size, max_upload_filesize und max_file_uploads: http: // de.php.net/manual/en/ini.core.php#ini.post-max-size – dbrumann