I have this upload form working great. I am using the "\'" format to get single quotes from now on. But, I added a script to check the file extension and it wont upload anything. Anybody see anything wrong here...? It bring the error message up regardless it the file has a .pdf extension or not and wont uplaod.
--
<?php
echo '<html>
<head>
<title>test page</title>
<script type="text/JavaScript">
<!-- Begin
function TestFileType( fileName, fileTypes ) {
if (!fileName) return;
dots = fileName.split(".")
fileType = "." + dots[dots.length-1];
return (fileTypes.join(".").indexOf(fileType) != -1) ?
alert(\'That file is OK!\') :
alert("Please only upload PDF format files with the correct .pdf extension. Please select a new file and try again.");
}
// -->
</script>
</head>
<body>
<form method="post" action="upload.php" enctype="multipart/form-data">
<input type="hidden" name="filename" value="'.$name.'">
<input type="file" name="uploadfile">
<input type="button" name="Submit" value="Upload" onclick="TestFileType(this.form.uploadfile.value, [\'pdf\'])"><br>
</body>
</html>
';
?>
--