Jump to content

I can't upload anything on increasing the number of words.


ankit.pandeyc012

Recommended Posts

<?php 
require_once('upper.php');
if(isset($_POST['submit']))
{
//This is code in which we can choose the type and size file uploaded or upload anything. We can declare the path of folder or can do without it.
if($_FILES['uploaded_file']['size']< 200000)
{
/*if($_FILES['uploaded_file']['error']>0)
{
echo "Error occurs".$_FILES['up_test']['error']."<br/>";
}
else{*/
$Title=$_POST['Title'];
$City=$_POST['City'];
$Content=$_POST['Content'];
$Date=$_POST['Date'];
echo "Uploaded Title--$Title<br/>";
echo "Uploaded City--$City<br/>";
echo "Uploaded Content--$Content<br/>";
echo "Uploaded Date of Event--$Date<br/>";

/*if(file_exists("upload/". $_FILES['uploaded_file']['name']))
{
echo "File".$_FILES['uploaded_file']['name']." already exists";
}
else
{*/
move_uploaded_file($_FILES['uploaded_file']['tmp_name'],"upload/".$_FILES['uploaded_file']['name']);
echo "File uploaded-- ".$_FILES['uploaded_file']['name']."<br><br><br>";
}
else{
echo "File size is too large or Not Uploaded ";
}
$path="upload/".$_FILES['uploaded_file']['name'];
require_once('database.php');
$result=mysqli_query($dbc,"insert into events (Title,City,Content,Photo,Date) values ('$Title','$City','$Content','$path','$Date')") or die ('Not Connected Events');
//echo "PAth";
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"
enctype="multipart/form-data">
<h4>Enter Events</h4><br>
Enter Title <br><textarea rows="10" cols="10" name="Title"></textarea><br>
Enter City <br><input type="text" name="City"><br>
Enter Content <br><textarea rows="10" cols="10" name="Content"></textarea><br>
<label for="file">Upload Photo<br></label>
<input type="file" name="uploaded_file"  /> 
<br />
Enter Date of Event<br> <input type="text" name="Date" value="yyyy-mm-dd"><br>
<input type="submit" name="submit" value="Upload" />
</form>
<?php require_once('lower.php');?>

</body>
</html>

 

 

Hi friends...............

In above code when i upload title or content within range of 20 words it works properly but when I increase numbers of words till approx. 100 words. It gives an error "Not Connected Events". Not any file is uploaded in database.

I set the length of title and content in phpmyadmin is 500 and 1000 and type is varchar respectively.

I can't understand where is problem????????

I think it's about something size???????

Help me Anyone???????????????

<?php 
require_once('upper.php');
if(isset($_POST['submit']))
{
//This is code in which we can choose the type and size file uploaded or upload anything. We can declare the path of folder or can do without it.
if($_FILES['uploaded_file']['size']< 200000)
{
/*if($_FILES['uploaded_file']['error']>0)
{
echo "Error occurs".$_FILES['up_test']['error']."<br/>";
}
else{*/
$Title=$_POST['Title'];
$City=$_POST['City'];
$Content=$_POST['Content'];
$Date=$_POST['Date'];
echo "Uploaded Title--$Title<br/>";
echo "Uploaded City--$City<br/>";
echo "Uploaded Content--$Content<br/>";
echo "Uploaded Date of Event--$Date<br/>";

/*if(file_exists("upload/". $_FILES['uploaded_file']['name']))
{
echo "File".$_FILES['uploaded_file']['name']." already exists";
}
else
{*/
move_uploaded_file($_FILES['uploaded_file']['tmp_name'],"upload/".$_FILES['uploaded_file']['name']);
echo "File uploaded-- ".$_FILES['uploaded_file']['name']."<br><br><br>";
}
else{
echo "File size is too large or Not Uploaded ";
}
$path="upload/".$_FILES['uploaded_file']['name'];
require_once('database.php');
$result=mysqli_query($dbc,"insert into events (Title,City,Content,Photo,Date) values ('$Title','$City','$Content','$path','$Date')") or die ('Not Connected Events');
//echo "PAth";
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"
enctype="multipart/form-data">
<h4>Enter Events</h4><br>
Enter Title <br><textarea rows="10" cols="10" name="Title"></textarea><br>
Enter City <br><input type="text" name="City"><br>
Enter Content <br><textarea rows="10" cols="10" name="Content"></textarea><br>
<label for="file">Upload Photo<br></label>
<input type="file" name="uploaded_file"  /> 
<br />
Enter Date of Event<br> <input type="text" name="Date" value="yyyy-mm-dd"><br>
<input type="submit" name="submit" value="Upload" />
</form>
<?php require_once('lower.php');?>

</body>
</html>

 

 

Hi friends...............

In above code when i upload title or content within range of 20 words it works properly but when I increase numbers of words till approx. 100 words. It gives an error "Not Connected Events". Not any file is uploaded in database.

I set the length of title and content in phpmyadmin is 500 and 1000 and type is varchar respectively.

I can't understand where is problem????????

I think it's about something size???????

Help me Anyone???????????????

On calling die(mysli_error()) in place of "Not Connected". I got this error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near _______"

Now I don't know what I should do??????

Help plz...............

it might help to be able to actually see the sql.

 

$sql = "insert into events (Title,City,Content,Photo,Date) values ('$Title','$City','$Content','$path','$Date')";
$result=mysqli_query($dbc,$sql) or die (mysqli_error($dbc) . " IN $sql");

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.