Posts

Showing posts from May, 2017

Function Oriented File Upload PHP

Image
Put the Following Function here:
<?php
function uploadimgfile($index,$folder="other",$prefix="other")
{
$target_dir ="upload_directory_path/";  // try to put full physical path
 // identity accstatement address advtimg other
$uploadOk = 1;
$senddata=array();
$senddata['data']="NILL";
$notallowed=array("php","js","css","html");  // defined here the extesion not to upload
$shownotallowed = "PHP, JS, CSS, HTML fie is not allowed to upload.";
$extension=explode(".",basename($_FILES[$index]["name"]));
$extension=end($extension);
ECHO "<hr/>" . $realfilnename=basename($_FILES[$index]["name"]);


$datetofolder=date("Y/M/d");
$datetofolder=strtolower($datetofolder);

$checkdirectory = $target_dir."$folder/$datetofolder";

if (!file_exists($checkdirectory))
{
mkdir($checkdirectory, 0777, true);
}

$filnename ="$folder/$datetofolder/$prefix".md5…