-1
我有一個腳本在去年提交給它自己時起作用。我不得不重做它,以便提交是在自己的網頁上,但不是這些文件根本沒有上傳!該腳本不會產生任何錯誤,所以我似乎無法弄清楚問題所在。下面是腳本的相關部分(除去多餘的代碼):文件沒有通過PHP上傳
<?php
if (isset($_POST['title']) && !empty($_POST['title'])) {
// Set POST as variables
$title = $_POST['title'];
$name = $_POST['name'];
$email = $_POST['email'];
$time = time();
$resumefilename = "";
$rfilename = strtolower($_FILES['resume']['name']);
$rfiletype = strtolower($_FILES['resume']['type']);
$ruploadname = str_replace(" ", "-", trim($name)) . "-" . str_replace(" ", "-", trim($title)) . "-resume";
$ruploadname = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $ruploadname);
$ruploadname = strtolower($ruploadname);
// Folder where images will be stored
$uploaddir = 'uploads/';
///////////////////////////////////////////////////////////////////////////
// SECURITY - Checks if file contains PHP and kills if positive
$rpos = strpos($rfilename, 'php');
if(!($rpos === false)) { die('Error, Bad File Type'); }
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// Resume File Check
$file_ext = strrchr($rfilename, '.');
$allowedExts = array(
"pdf",
"doc",
"docx"
);
$allowedMimeTypes = array(
'text/pdf',
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
);
if (!(in_array($file_ext, $allowedExts))) {
$error .= '<p>Invalid file type detected for Resume: please upload pdf, doc, or docx files only. Thank you.</p>';
}
if(in_array($_FILES["resume"]["type"], $allowedMimeTypes)){
$ruploadfile = $uploaddir.$time.'-'.$ruploadname.$file_ext;
$resumefilename = $time.'-'.$ruploadname.$file_ext;
$remailname = $ruploadname.$file_ext;
if (move_uploaded_file($_FILES['resume']['tmp_name'], $ruploadfile)) {
$resumesuccess = 1;
} else {
$resumesuccess = 0;
}
}
///////////////////////////////////////////////////////////////////////////
}
>
只是爲了涵蓋基本問題,導演確實存在正確的權限。 – Aerdan 2014-09-20 02:30:39
你也可以顯示錶單嗎? – marian0 2014-09-20 02:32:01
你能告訴我表格 – sush 2014-09-20 02:33:17