phpretard Posted August 2, 2009 Share Posted August 2, 2009 The Files uploading but I cant seem to get the extention after renaming it. Any thoughts? <?php function findexts($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } define ("FILEREPOSITORY","./"); if (is_uploaded_file($_FILES['file']['tmp_name'])) { if ((($_FILES["file"]["type"] != "image/gif") || ($_FILES["file"]["type"] != "image/jpeg") || ($_FILES["file"]["type"] != "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { echo "<p>Wrong file format format.</p>"; } else { $name = $_POST['name']; $exts= $_FILES['type']; $result = move_uploaded_file($_FILES['file']['tmp_name'], FILEREPOSITORY."/$name.$exts"); if ($result == 1) echo "<p>File successfully uploaded.</p>"; else echo "<p>There was a problem uploading the file.</p>"; } #endIF } #endIF ?> <form action="<?php print $PHP_SELF?>" enctype="multipart/form-data" method="post"> Last Name:<br /> <input type="text" name="name" value="" /><br /> Class Notes:<br /> <input type="file" name="file" id="file" value="" /><br /> <p><input type="submit" name="submit" value="Submit Notes" /></p> </form> Thank you! Quote Link to comment Share on other sites More sharing options...
gevans Posted August 2, 2009 Share Posted August 2, 2009 I see you have a function, but where are you trying to use it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.