Jump to content

unable to view photo in sql and in webpage


xanie

Recommended Posts

can u locate the error? thanks..

itcouldn't able to save photos on sql..

<?php
if(isset($_POST['submit']))
	 {
	 $title = $_POST['title'];
	 $details = $_POST['details'];
	 $month = $_POST['Month'];
	 $day= $_POST['Day'];
	 $year= $_POST['Year'];
	 $date= "$month $day,$year";
	 $image=$_POST['image'];


	 if(!empty($_FILES['image']['name']))
	 {
	 $fileName = $_FILES['image']['name'];
	 $tmpName = $_FILES['image']['tmp_name'];
	 $fileSize = $_FILES['image']['size'];
	 $fileType = $_FILES['image']['type'];
	 $fp	 = fopen($tmpName, 'r');
	 $content = fread($fp, filesize($tmpName));
	 $content = addslashes($content);
	 fclose($fp);
	 if(!get_magic_quotes_gpc())
	 {
	 $fileName = addslashes($fileName);
	 }
	 }
	 else
	 {
	 $content = "NULL";
	 $fileName = "NULL";
	 $fileType = "NULL";
	 }

 }
mysql_query
("INSERT INTO newsandevents(
date,
details,
title,
photo,
photo_name,
photo_file_type

)
VALUES(
'$date',
'$details',
'$title' ,
'$content',
'$fileName',
'$fileType')") or die(mysql_error());

header('location:../News2.php');

print '<script type="text/javascript">';
print 'alert("Successfully added!")';
print '</script>';
?>

I'm not a big fan of online tests - for anything. If you actualy want help you will need to give a full and proper desciption of the problem whcih covers all aspects of what is going wrong as well as a description of each of the elements used in the process, such as the database column datatypes.

 

any and all Error/Warning/Notice messages should also be included.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.