1.<?php
2.$con = mysql_connect("localhost","root","")or die (mysql_error());
3.mysql_select_db("registration", $con);
4.function protect($value){
5.$value=mysql_real_escape_string($value);
6.$value=stripslashes($value);
7.$value=strip_tags($value);
8.}
9.if(isset($_POST) && $_FILES >0)
10.{
11.$fileName = $_FILES;
12.$tmpName = $_FILES;
13.$fileSize = $_FILES;
14.$fileType = $_FILES;
15.$fp = fopen($tmpName, 'r');
16.$content = fread($fp, filesize($tmpName));
17.$content = addslashes($content);
18.fclose($fp);
19.if(!get_magic_quotes_gpc())
20.{
21. $fileName = addslashes($fileName);
22.}
23.$sql = "INSERT INTO signup_image (name, size, type, content )
24.VALUES ('$fileName', '$fileSize', '$fileType', '$content')";
25.$result = mysql_query($sql);
26.$inserted_id = mysql_insert_id();
27. if($result) {
28. echo "<p>File $fileName uploaded</p>";
29.}
30.else{
31.echo"<p>file failed to be uploaded</p>";
32.}
33.}
34.mysql_close();
35.?>
if i try to upload i got message MySQL server has gone away in C:\wamp\www\""\photo.php on line 25
i try to look how but i failed to get answer plz help me.

Recommended Answers

All 2 Replies

Try This:

$sql = mysql_query("INSERT INTO signup_image (name, size, type, content) 
		
VALUES('$fileName', '$fileSize', '$fileType', '$content'") or die (mysql_error());

hi


suggest you try this .......joban.ali...... provide information.
and i think is solv the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.