File "upload_logo.php"

Full Path: /home/u165092617/domains/tadzz.com/public_html/forms/upload_logo.php
File size: 1.69 KB
MIME-type: text/x-php
Charset: utf-8

<?php session_start();
   include("../config/config.php");
   //require_once("../validate_vendorlogin.php");
   
   
   /*file upload*/
   if (!empty($_FILES[SESS_MASTER.'company_logo']['name'])){
   	print_r($_FILES[SESS_MASTER.'company_logo']['name']);
   foreach($_FILES[SESS_MASTER.'company_logo']['name'] as $k => $ar){
      
   
   $company_logoload_flag="true";
   $company_logo_size=$_FILES[SESS_MASTER.'company_logo']['size'][$k];
   if ($_FILES[SESS_MASTER.'company_logo']['size'][$k]>2500000){
   $msg=$msg."Your uploaded file size is more than 2500KB ";
   $msg.=" so please reduce the file size and then upload.<BR>";
   $company_logoload_flag="false";
   }
   
   // allow only jpeg or gif files, remove this if not required //
   if (!($_FILES[SESS_MASTER.'company_logo']['type'][$k]=="image/jpeg" OR $_FILES[SESS_MASTER.'company_logo']['type'][$k] =="image/png"))
   {$msg=$msg."Your uploaded file must be of JPG or GIF. ";
   $msg.="Other file types are not allowed<BR>";
   $company_logoload_flag="false";}
   
   $file_name=$_FILES[SESS_MASTER.'company_logo']['name'][$k];
   // the path with the file name where the file will be stored
   $add="../images/coupon_img/".$file_name; 
   
   if($company_logoload_flag=="true"){ // checking the Flag value 
   
   if(move_uploaded_file ($_FILES[SESS_MASTER.'company_logo']['tmp_name'][$k], $add)){
   // do your coding here to give a thanks message or any other thing.
   $msg="File successfully uploaded";
   
   }else{
   echo "Failed to upload file Contact Site admin to fix the problem";
   }
   }else{
   $msg .= " Failed to upload file ";
   }
   } }
   echo $msg;
   /*file upload*/
    echo "<script>window.location='../merchant-id/3';</script>";
   
   ?>