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???????????????

Link to comment
Share on other sites

<?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...............

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.