Jump to content

image uplaod help please


phpretard

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/168456-image-uplaod-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.