Inside dialog setup:
- Code: Select all Expand view
?'<form action="../upload.php" method="post" enctype="multipart/form-data">'
?'<input type="file" name="file" id="file">'
?'<input type="submit" value="Upload Report" name="submit">'
?'</form>'
PHP Code:
- Code: Select all Expand view
<?php
$targetfolder = "PDF/";
$targetfolder = $targetfolder . basename( $_FILES['file']['name']) ;
$ok=1;
$file_type=$_FILES['file']['type'];
if ($file_type=="application/pdf") {
if(move_uploaded_file($_FILES['file']['tmp_name'], $targetfolder))
{
echo "The file ". basename( $_FILES['file']['name']). " is uploaded";
}
else {
echo "Problem uploading file";
}
}
else {
echo "You may only upload PDFs<br>";
}
?>