csv file upload

<?php session_start(); if (!$_SESSION["userid"]) { // User not logged in, redirect to login page header("location: index.php"); } ?> <?php require_once('classes/tc_calendar.php'); ?> <?php $newbal='0'; include "conn.php"; if(isset($_POST['submit'])) { $filename=$_POST['filename']; $handle = fopen("$filename", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $sql5=mysql_query("select * from item where item='$data[0]'"); $num=mysql_num_rows($sql5); if($num==0) { $import="INSERT into item(item,gweight,dweight) values('$data[0]','$data[1]','$data[2]')"; mysql_query($import) or die(mysql_error()); } else{ echo"$data[0] exit "; } } fclose($handle); print "Import done"; } else { ?> <?php include "header.php"; ?>
       Type file name to import:
	   Date
              <?php
			  date_default_timezone_set("Asia/Calcutta");
  $myCalendar = new tc_calendar("date", true, false);
  $myCalendar->setIcon("images/iconCalendar.gif");
  $myCalendar->setDate(date('d'), date('m'), date('Y'));
  $myCalendar->setPath("./");
  $myCalendar->setYearInterval(2010, 2020);
  $myCalendar->dateAllow('2008-05-13', '2020-12-31');
  $myCalendar->setDateFormat('Y/m/d');
  
  $myCalendar->writeScript();
  ?>
        <input type='submit' name='submit' value='submit'></form>
<?php		

}
?>

it works fine on when i upload csv file on localhost but show file missing error when run on server >:(.please help me,thanks in advance :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service