Page 1 of 1

Warning: file_get_contents(C:\xampp\tmp\php4C4F.tmp): failed

Posted: Mon Feb 27, 2017 12:44 am
by mohit5616
hello sir/i am from india ,i face the problem with warning ,Warning: file_get_contents(C:\xampp\tmp\php4C4F.tmp): failed to open stream: No such file or directory in C:\xampp\htdocs\Image_upload\newimage.php on line 15 . Help me to identified the error.


Code: Select all

<?php
include('con_ini.php');
if(isset($_POST['submit']))
{
	//print_r($_FILES['filename']);
	$image=$_FILES['filename']['name'];
	echo $image_tmp=$_FILES['filename']['tmp_name'];
	$image_type=$_FILES['filename']['type'];
	$image_size=$_FILES['filename']['size'];
	
	$store="Tmp/".$image;
	$var=move_uploaded_file($image_tmp,$store);
	echo '<br>uploaded!';
	$file=file_get_contents($image_tmp);
	$query=mysql_query('insert into folder(image_name)values($file)',$conn);
	if(!$query)
	{
		die(mysql_error());
	}
	else
	{
	$row=mysql_fetch_row($query);
	echo $row[1];
	}
	}
?>
<html>
<body> 
<form action="newimage.php" method="post" enctype="multipart/form-data">
<p><input type="file" name="filename" /></p>
<p><input type="submit" value="upload" name="submit" /></p>
</form>
</body>
</html>

Re: Warning: file_get_contents(C:\xampp\tmp\php4C4F.tmp): fa

Posted: Mon Feb 27, 2017 3:10 am
by requinix
You can't file_get_contents something after you've move_uploaded_file it somewhere else, but you can get the file at its new location.