我有一个 Dropbox 上传脚本,它工作正常,但是,我需要让邮件收件人知道文件已经/尚未上传到 Dropbox。下面是我正在使用的代码...
<?
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
mail("test@email.co.uk","Website Print Shop Enquiry","Form data:
Contact Name: " . $_POST['field_1'] . "
Company (if applicable): " . $_POST['field_2'] . "
Address (optional): " . $_POST['field_3'] . "
Postcode: " . $_POST['field_4'] . "
Phone: " . $_POST['field_5'] . "
Email: " . $_POST['field_6'] . "
Dropbox File Uploaded?: " . >>RESULT HERE<< . "
Details of enquiry: " . $_POST['field_7'] . " ",$headers);
if ($_POST) {
require 'DropboxUploader.php';
try {
// Rename uploaded file to reflect original name
if ($_FILES['file']['error'] !== UPLOAD_ERR_OK)
throw new Exception('File was not successfully uploaded from your computer.');
$tmpDir = uniqid('/tmp/DropboxUploader-');
if (!mkdir($tmpDir))
throw new Exception('Cannot create temporary directory!');
if ($_FILES['file']['name'] === "")
throw new Exception('File name not supplied by the browser.');
$tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $_FILES['file']['name']);
if (!move_uploaded_file($_FILES['file']['tmp_name'], $tmpFile))
throw new Exception('Cannot rename uploaded file!');
// Enter your Dropbox account credentials here
$uploader = new DropboxUploader('username is here', 'password is here');
$uploader->upload($tmpFile, $_POST['dest']);
} catch(Exception $e) {
}
// Clean up
if (isset($tmpFile) && file_exists($tmpFile))
unlink($tmpFile);
if (isset($tmpDir) && file_exists($tmpDir))
rmdir($tmpDir);
}
include("confirm-print.htm");
}
else {
echo "Invalid Captcha String. Please use the back button in your browser and try again, thank you.";
}
?>
试图找到我需要访问的变量以显示文件是否已上传。相关的 DropboxUploader.php 文件位于https://github.com/jakajancar/DropboxUploader/blob/master/DropboxUploader.php感谢您的帮助!