MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/latestnews/settings/
File Upload :
Current < : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/latestnews/settings/news_val.php

<?php
include("connection.php");
session_start();
$name=$_SESSION['username'];


$contents=mysql_real_escape_string($_POST['contents']);
$subject=mysql_real_escape_string($_POST['subject']);
$category=mysql_real_escape_string($_POST['category']);
$youtube=mysql_real_escape_string($_POST['youtube']);
$date=date('d-m-Y');
 
     
 $file = rand(1000,100000)."-".$_FILES['file']['name'];
    $file_loc = $_FILES['file']['tmp_name'];
 $file_size = $_FILES['file']['size'];
 $file_type = $_FILES['file']['type'];
 $folder="uploads/";
 $id=1;
 // new file size in KB
 $new_size = $file_size/1024;  
 // new file size in KB
 
 // make file name in lower case
 $new_file_name = strtolower($file);
 // make file name in lower case
 
 $final_file=str_replace(' ','-',$new_file_name);
 
 if(move_uploaded_file($file_loc,$folder.$final_file))
 {
	$query=mysql_query("INSERT INTO news_post VALUES(' ','$name','$final_file','$file_type','$file_size','$subject','$contents','$category','$date',' ','$youtube')") or die(mysql_error());
if($query){	
  ?>
  <script>
  alert('successfully uploaded');
        window.location.href='more_images.php';
        </script>
  <?php
 }
 else
 {
  ?>
  <script>
  alert('error while uploading file');
        window.location.href='admin.php?fail';
        </script>
  <?php
 }
 }
?>