Jump to content

requesting upload script


izlik

Recommended Posts

Hey..

 

What do you mean with multiple categories to choose?

 

here I post a small piece of code to "validate" an upload file

<?php

$extensions = array(".jpg",".png",".jpeg",".gif");

if( is_uploaded_file($_FILES['image1']['tmp_name']) ){

  $image1ext = substr(strrchr ($_FILES['image1']['name'], "."), 0);  // get the extension
  $image1name = "name_of_the_file"; //without the extension

  if( in_array($image1ext,$extensions) ){

    if( !move_uploaded_file($_FILES['image1']['tmp_name'],"./upload_directory/".$image1name.$image1ext) ){
          die("Cant move file");  
     } else {
        echo "Success!"; 
    }
  } else {
     echo "Invalid File Type. The uploaded file is not a valid image file.";
  }
}

?>

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.