-1
我是cakephp.php上傳的新文件。我可以通過php.php上傳pdf文件。我想通過cakephp上傳pdf文件。任何人都可以給我一個最佳參考?通過PHP代碼由cakephp 2.0上傳的pdf文件
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload Example</title>
</head>
<body>
<form action="upload3.php" method="post" enctype="multipart/form-data">
<input type="file" name="filepdf" /><br />
<input type="submit" value="Upload menu pdf" name="upload_pdf" />
</form>
</body>
</html>
php file
<?php
$pdfPath = "pdf";
$maxSize = 102400000000;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['upload_pdf'])) {
if (is_uploaded_file($_FILES['filepdf']['tmp_name'])) {
if ($_FILES['filepdf']['type'] != "application/pdf") {
echo '<p>Il file non è un PDF</p>';
} else if ($_FILES['filepdf']['size'] > $maxSize) {
echo '<p class="error">File troppo grande. Dimensione massima: ' . $maxSize . 'KB</p>';
} else {
$menuName = 'file.pdf';
$result = move_uploaded_file($_FILES['filepdf']['tmp_name'], $pdfPath . $menuName);
if ($result == 1) {
echo '<p class="error">File Uploaded!!</p>';
} else {
echo '<p class="error">Si è verficato un errore</p>';
}
}
}
}
?>
上傳PDF文件,現在我想這樣做同樣的工作由cakephp.I對MVC一個清晰的概念。
我已經做了view.Now需要幫助控制器和模塊。