123456789101112131415161718192021222324252627 |
- <?php
- $targetFolder = '/uploads';
- if (!empty($_FILES)) {
- $tempFile = $_FILES['Filedata']['tmp_name'];
- $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
- $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
-
-
- $fileTypes = array('jpg','jpeg','gif','png');
- $fileParts = pathinfo($_FILES['Filedata']['name']);
-
- if (in_array($fileParts['extension'],$fileTypes)) {
-
- echo '1';
- } else {
- echo 'Invalid file type.';
- }
- }
- ?>
|