I am trying to simply place an image in the folder using image upload in php but it is not working, please help me what is the problem with it.. thanx :)
this is my code for setup.php
<?php include("../includes/config.php"); ?>
<?php
if ($_SESSION["isadmin"])
{
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result = mysql_query("SELECT * FROM setup WHERE (id=".$_SESSION["id"].")");
while($row = mysql_fetch_array($result))
{
$title = $row['title'];
$theme = $row['theme'];
}
mysql_close($con);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Admdin Home</title>
<link rel="StyleSheet" href="css/style.css" type="text/css" media="screen">
</head>
<body>
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>
<?php include("includes/aside.php"); ?>
<div id="maincontent">
<div id="breadcrumbs">
Home >
Setup >
Customization
</div>
<h2>Customize</h2>
<?php
if (isset($_GET["status"]))
{
if($_GET["status"]==1)
{
echo("<strong>Customization Done!</strong>");
}
if($_GET["status"]==2)
{
echo("<strong>Customization Error!!</strong>");
}
}
?>
<form method="post" action="setup-action.php" enctype="multipart/form-data" >
<label>Title Of Your Organization:</label> <input type="text" name="title" value="<? php echo $title; ?>" /> <br /> <br />
<label>Select Theme</label>
<select name="theme" value="<?php echo $theme; ?>">
<option value="Default">Default</option>
<option value="Dark">Dark</option>
<option value="White">White</option>
</select>
<br /> <br />
<label>Choose Your Logo Here</label><input type="file" name="file"/><br /> <br />
<input type="submit" name="Upload" value="Upload" />
</form>
</div>
</body>
<?php include("includes/footer.php"); ?>
</html>
<?php
}
else
{
header("Location: ".$fullpath."login/unauthorized.php");
}
?>
this is setup-action.php
<?php include("../includes/config.php");?>
<?php
if(isset($_FILES["file"]))
{
if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 1000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
if (file_exists("../graphics/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["name"], "../graphics/" . $_FILES["file"]["name"]);
echo "Stored in: " . "../graphics/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
<?php
$title=$_POST["title"];
$theme=$_POST["theme"];
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result=mysql_query("SELECT * FROM setup WHERE id=".$_SESSION['id']);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
{
mysql_query("UPDATE setup SET title='".$title."' , theme='".$theme."'WHERE id=".$_SESSION['id']);
header("Location:setup.php?status=1");
}
}
else {
header("Location:setup.php?status=2");
}
mysql_close($con);
?>
I am not completely certain about this, but I think you need to use tmp_name in the move_uploaded_file, as the file receives a temporary name and location untill moved.
Like so:
move_uploaded_file($_FILES["file"]["tmp_name"],"your/path/".$_FILES["file"]["name"]);
Hope it works... Everything else did seem perfectly ok to me.
Need to use the uploaded file's temp name in the move_uploaded_file() function. The temp name contains the path to the file saved in temporary storage
Related
I am inserting file record in table with title of file, path, filename.
The issue is when I enter title without the spaces the record gets inserted in the database but if I add spaces in title then the record is not getting inserted.
Only the file gets uploaded on the server if I add space in title and record dose not get inserted in the database.
If I do not add space in title it works well.
Main page
<?php
ini_set('display_errors', 1);
error_reporting(1);
ini_set('error_reporting', E_ALL);
session_start();
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
?>
<!DOCTYPE html>
<html>
<head> </head>
<body>
<title>File upload</title>
<form action="fileUpload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<br><br>
<input name = "file" type="file" id="fileToUpload"><br><br>
Enter title : <input name="title" id="title" type="text"><br><br>
Select question type : <br><br>
<?php
if (isset($_SESSION['type']))
{
$type = $_SESSION["type"]; ?>
<div id="types">
SSgt <input name="type" type="radio" id="t2" value="SSgt" <?=($type==1?"checked":"");?>>
TSgt <input name="type" type="radio" id="t1" value="TSgt" <?=($type==2?"checked":"");?>>
MSgt <input name="type" type="radio" id="t3" value="MSgt" <?=($type==3?"checked":"");?>>
</div> <br><br>
<?php
}
else {
?>
<div id="types">
SSgt <input name="type" type="radio" id="t2" value="SSgt">
TSgt <input name="type" type="radio" id="t1" value="TSgt">
MSgt <input name="type" type="radio" id="t3" value="MSgt">
</div> <br><br>
<?php
}
?>
<input type="submit" value = "Upload File">
</form>
</body>
</html>
File upload
<?php
ini_set('display_errors', 1);
error_reporting(1);
ini_set('error_reporting', E_ALL);
session_start();
$file_result = "";
if($_FILES["file"]["error"] > 0)
{
$file_result .= "No file uploaded or invalid file.";
$file_result .= "Error code : " . $_FILES["file"]["error"] . "<br>" ;
}
else{
$target_dir = "files/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$file_result .=
"Upload " . $_FILES["file"]["name"] . "<br>" .
"type " . $_FILES["file"]["type"] . "<br>" .
"temp file " . $_FILES["file"]["tmp_name"] . "<br>";
if(move_uploaded_file($_FILES["file"]["tmp_name"],$target_file)){
echo "The file ". basename( $_FILES['file']['name']). " has been uploaded, and your information has been added to the directory";
$type = $_POST['type'];
$title = $_POST['title'];
if(strcmp($type,'SSgt') == 0)
{
$queType = 1;
}
elseif(strcmp($type,'TSgt') == 0)
{
$queType = 2;
}
elseif(strcmp($type,'MSgt') == 0)
{
$queType = 3;
}
$dbh = new PDO('mysql:host=;dbname=air','airman', 'ai');
//Writes the information to the database
$stmt = $dbh->prepare("INSERT INTO files (file,type,title,path) VALUES (?,?,?,?)");
$stmt->execute(array($_FILES['file']['name'],$queType,$title,$target_file));
if ($dbh->lastInsertId())
{
//echo 'File inserted .';
$_SESSION["type"] = $queType;
echo '<br> Upload another file.';
}
else
{
echo($title);
echo 'File could not insert.';
}
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}
}
?>
I am beginner in web development, can anyone help me with these please? Thank you..
Enable PDO Exceptions with
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION`);
after your connect
I am trying to combine multiple form elements. I have 2 buttons, 1 tex tbox and 1 upload box and 1 drop down menu as shown below:
So the user can select a directory where to upload, create a new one by clicking the 'Create' button and Upload files. However, with my current code, it does not work (files are uploaded to default directory).
This is the code:
<?php
include("login.php");
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FileStore - Upload Files</title>
<link rel="stylesheet" href="./CSS/style.css" type="text/css" media="screen, projection" />
</head>
<body>
<div id="wrapper">
<header id="header">
<div id="header-content">
<strong><h1>FileStore</h1></strong> Upload multiple files at once!
</div>
<div class="login-info" >
<?php
if ($isLoggedin === false) {
echo ' <form action="" method="POST">
Username: <input name="username" >
Password: <input type="password" name="password" size="8">
<input type="submit" name="submit" value="Login">
</form>';
echo "<p align='right'>You are not logged in.</p>";
echo "<b><a href='registration.php'>Register</a></b>";
}else{
echo $welcomeMsg;
}
?>
</div>
</header><!-- #header-->
<section id="middle" align="center">
<div id="container">
<br><br>
<div id="content">
<strong><h1>Upload files</h1></strong><br><br>
<div id="upload-file" >
<form action="" method="post" enctype="multipart/form-data">
<input type="file" value="" name="upload[]" multiple>
<button type="submit">Upload!</button>
</form>
<select name="myDirs">
<option value="" selected="selected">Select a folder</option>
<?php
if (chdir("./files/" . $userid)) {
$dirs = glob('*', GLOB_ONLYDIR);
foreach($dirs as $val){
echo '<option value="'.$val.'">'.$val."</option>\n";
}
} else {
echo 'Changing directory failed.';
}
?>
<?php
include("dbConfig.php");
$Username = $_SESSION["username"];
global $userid;
$sql = "SELECT UserID FROM users WHERE Username = '".$Username."'";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
$userid = $row['UserID'];
}
$newDir = $_REQUEST["newDir"];
$upload_dir = './files/' . (string)$userid . '/';
$folder_path = $upload_dir . "/" . $newDir . "/" ;
if (!file_exists($folder_path)) {
mkdir($folder_path, 0777, true);
chmod($folder_path, 0777);
echo "Folder" . $newDir . "created.";
echo "Redirecting to upload page..";
header( 'Location: ../upload.php' ) ;
} else {
echo "Error creating " . $newDir;
}
echo "<form action='' method='post'>";
echo "<input type='text' name='newDir'> ";
echo "<input type='submit' value='Create'>";
echo "</form>";
?>
<?php
include("dbConfig.php");
$Username = $_SESSION["username"];
global $userid;
global $up_path;
$error_message[0] = "Unknown problem with upload.";
$error_message[1] = "Uploaded file too large (load_max_filesize).";
$error_message[2] = "Uploaded file too large (MAX_FILE_SIZE).";
$error_message[3] = "File was only partially uploaded.";
$error_message[4] = "Choose a file to upload.";
$sql = "SELECT UserID FROM users WHERE Username = '".$Username."'";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
$userid = $row['UserID'];
}
$vpath = strlen($userid);
$upload_dir = './files/' . (string)$userid . '/';
$num_files = count($_FILES['upload']['name']);
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0777, true);
chmod($upload_dir, 0777);
} else {
for ($i=0; $i < $num_files; $i++) {
$upload_file = $upload_dir . urlencode(basename($_FILES['upload']['name'][$i]));
if (#is_uploaded_file($_FILES['upload']['tmp_name'][$i])) {
if (#move_uploaded_file($_FILES['upload']['tmp_name'][$i],
$upload_file)) {
/* Great success... */
echo basename($upload_file) . " has been uploaded. <br>";
//$content = file_get_contents($upload_file);
//echo $content;
} else {
print $error_message[$_FILES['upload']['error'][$i]];
}
} else {
print $error_message[$_FILES['upload']['error'][$i]];
}
}
}
?>
</div>
</div><!-- #content-->
</div><!-- #container-->
<aside id="sideLeft">
<div id="menu-x" align="center"><br>
<strong>Menu</strong><br><br>
<div class="menu">
<ul>
<li>Home</li>
<li>Upload</li>
<li>Files</li>
<li>About</li>
<li>Help</li>
<li>Logout</li>
</ul>
<br style="clear:left"/>
</div>
</div>
</aside><!-- #sideLeft -->
</section><!-- #middle-->
<footer id="footer">
<strong>FileStore:</strong> A CMT 3315 Project by Brian Livori
</footer><!-- #footer -->
</div><!-- #wrapper -->
</body>
</html>
I wan to enable the user to create a directory before uploading, and then choose a directory to upload by selecting an option from the drop down.
How can I do this?
Your form tag ends before select box so move it below select box and you should get your post values related to chosen upload dir.
iam new to php, i am using image upload script of php to update my logo, whenever user choose the image file the existing image file should be replaced by the new upoaded file and should be updated on the screen as well, for this iam using this script but its not doing anything, i mean its nor replacing the image neither putting the new image into the folder... :( please help me get out of this problem, i've been in this problem since months..
this is setup.php
<?php include("../includes/config.php"); ?>
<?php
if ($_SESSION["isadmin"])
{
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result = mysql_query("SELECT * FROM setup WHERE (id=".$_SESSION["id"].")");
while($row = mysql_fetch_array($result))
{
$title = $row['title'];
$theme = $row['theme'];
}
mysql_close($con);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Admdin Home</title>
<link rel="StyleSheet" href="css/style.css" type="text/css" media="screen">
</head>
<body>
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>
<?php include("includes/aside.php"); ?>
<div id="maincontent">
<div id="breadcrumbs">
Home >
Setup >
Customization
</div>
<h2>Customize</h2>
<?php
if (isset($_GET["status"]))
{
if($_GET["status"]==1)
{
echo("<strong>Customization Done!</strong>");
}
if($_GET["status"]==2)
{
echo("<strong>Customization Error!!</strong>");
}
}
?>
<form method="post" action="setup-action.php" enctype="multipart/form-data" >
<label>Title Of Your Organization:</label> <input type="text" name="title" value="<? php echo $title; ?>" /> <br /> <br />
<label>Select Theme</label>
<select name="theme" value="<?php echo $theme; ?>">
<option value="Default">Default</option>
<option value="Dark">Dark</option>
<option value="White">White</option>
</select>
<br /> <br />
<label>Choose Your Logo Here</label><input type="file" name="file"/><br /> <br />
<input type="submit" name="Upload" value="Upload" />
</form>
</div>
</body>
<?php include("includes/footer.php"); ?>
</html>
<?php
}
else
{
header("Location: ".$fullpath."login/unauthorized.php");
}
?>
and this is setup-action.php
<?php include("../includes/config.php");?>
<?php
if(isset($_FILES["file"]))
{
if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 1000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
if (file_exists("../graphics/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["name"],
"../graphics/" . $_FILES["file"]["name"]);
echo "Stored in: " . "../graphics/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
<?php
$title=$_POST["title"];
$theme=$_POST["theme"];
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result=mysql_query("SELECT * FROM setup WHERE id=".$_SESSION['id']);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
{
mysql_query("UPDATE setup SET title='".$title."' , theme='".$theme."'WHERE id=".$_SESSION['id']);
header("Location:setup.php?status=1");
}
}
else {
header("Location:setup.php?status=2");
}
mysql_close($con);
?>
See this URL
http://www.tizag.com/phpT/fileupload.php
Try this:-
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
uploder.php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
STEP1: Create file upload.php
############### Code
`<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><strong>Single File Upload </strong></td>
</tr>
<tr>
<td>Select file
<input name="ufile" type="file" id="ufile" size="50" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
`
STEP2: Create file upload_ac.php
############### Code
<?php
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$HTTP_POST_FILES['ufile']['name'];
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
//$HTTP_POST_FILES['ufile']['name'] = file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
echo "<img src=\"$path\" width=\"150\" height=\"150\">";
}
else
{
echo "Error";
}
}
?>
im new to php and i want to update a logo, i mean i want to upload an image file which i want to be replaced by the logo.png and shown as a logo on my webpage, the code till now is uploading an image and saving the image in the folder but not replacing the exixting image with the new one, olease help me solve this problem, thanku
this is setup.php
<?php include("../includes/config.php"); ?>
<?php
if ($_SESSION["isadmin"])
{
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result = mysql_query("SELECT * FROM setup WHERE (id=".$_SESSION["id"].")");
while($row = mysql_fetch_array($result))
{
$title = $row['title'];
$theme = $row['theme'];
}
mysql_close($con);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Admdin Home</title>
<link rel="StyleSheet" href="css/style.css" type="text/css" media="screen">
</head>
<body>
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>
<?php include("includes/aside.php"); ?>
<div id="maincontent">
<div id="breadcrumbs">
Home >
Setup >
Customization
</div>
<h2>Customize</h2>
<?php
if (isset($_GET["status"]))
{
if($_GET["status"]==1)
{
echo("<strong>Customization Done!</strong>");
}
if($_GET["status"]==2)
{
echo("<strong>Customization Error!!</strong>");
}
}
?>
<form method="post" action="setup-action.php" enctype="multipart/form-data" >
<label>Title Of Your Organization:</label> <input type="text" name="title" value="<?php echo $title; ?>" /> <br /> <br />
<label>Select Theme</label>
<select name="theme" value="<?php echo $theme; ?>">
<option value="Default">Default</option>
<option value="Dark">Dark</option>
<option value="White">White</option>
</select>
<br /> <br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" name="Upload" value="Upload" />
</form>
</div>
</body>
<?php include("includes/footer.php"); ?>
</html>
<?php
}
else
{
header("Location: ".$fullpath."login/unauthorized.php");
}
?>
this is setup-action.php
<?php include("../includes/config.php");?>
<?php
$target_path = "../graphics/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}
?>
<?php
$title=$_POST["title"];
$theme=$_POST["theme"];
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$result=mysql_query("SELECT * FROM setup WHERE id=".$_SESSION['id']);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
{
mysql_query("UPDATE setup SET title='".$title."' , theme='".$theme."'WHERE id=".$_SESSION['id']);
header("Location:setup.php?status=1");
}
}
else {
header("Location:setup.php?status=2");
}
mysql_close($con);
?>
Have a look at PHP File Upload Tutorial. You may use logo.png as the file name.
New to this, but already I'm scratching my head. Vids aren't uploading/being created, but there's no error msg, and also the filenames/directory location's being recorded into MySQL.
HUH?!
Here's the code:
<?php
date_default_timezone_set("America/New_York");
include("functionpage.php");
session_start();
if (isset($_SESSION['firstname']))
{
if (isset($_POST["submit"]) && $_FILES["uploadfile"]["name"] != "")
{
if (!$connect = mysqli_connect($lh, $rt, $pw, $gj))
{
echo "<p>We're sorry, but the connection to the server is currently unavailable. <br /> Thank you for your patience.<br /><br />
exit();
}
$namefirst = $_SESSION['firstname'];
echo $namefirst."<br /><br />";
$sql = "SELECT * FROM cust_vids WHERE firstname = '$namefirst'";
$result = mysqli_query($connect,$sql);
if (mysqli_num_rows($result) > 0)
{
$rows = mysqli_fetch_assoc($result);
extract($rows);
$directory = "videos/".$username."/".$namefirst;
if(!is_dir($directory))
{
mkdir($directory);
}
$uploadfile = mysqli_real_escape_string($connect,$_FILES["uploadfile"]["name"]);
$uploadfile = strtolower(trim($uploadfile));
$vidtype = $_FILES["uploadfile"]["type"];
$vidsize = $_FILES["uploadfile"]["size"] / 1024;
$vidtmp = $_FILES["uploadfile"]["tmp_name"];
include("layout.php");
echo "Upload: " . $uploadfile . "<br />";
echo "Type: " . $vidtype . "<br />";
echo "Size: " . $vidsize . " Kb<br />";
echo "Stored in: " . $vidtmp."<br /><br />";
echo $username."<br />";
echo $firstname."<br />";
echo $namefirst."<br />";
$extension = explode(".",$uploadfile);
$ext = $extension[1];
$permloc = $directory.$uploadfile;
echo "<p>".$ext."<br />";
/*Will check to see if the file has an extension that isn't allowed*/
if ($ext != "swf" && $ext != "mov" && $ext != "wmv" && $ext != "avi" && $ext != "mpg" && $ext != "mpeg"
&& $ext != "mp4" && $ext != "flv")
{
echo "<p>We're sorry, but we do not support this type of file. <br />
Thank you for your patience.<br /><br />
Back to upload video form<br />
exit();
}
if (file_exists($permloc))
{
echo "<p>File already exists.<br /><br />
Back to Main Blog Page.</p>";
exit();
}
else
{
move_uploaded_file($vidtmp,$permloc);
echo "<br />New location: ".$permloc."<br /><br />";
$sql2 = "INSERT INTO cust_vids (username, firstname, uploadvids,videolocation)
VALUES (\"$username\",\"$firstname\", \"$uploadfile\", \"$permloc\")";
$result2 = mysqli_query($connect,$sql2);
if (!$result2)
{
echo "<p>Sorry, but your file was not uploaded into our records. Please try again.<br /><br />
Back to upload video form<br />
Back to Main Blog Page.</p>";
exit();
}
else
{
echo "<p>The file has been uploaded into your account successfully.<br /><br />
Back to Main Blog Page</p>";
exit();
}
}
}
else
{
include("layout.php");
echo "<p>We're sorry, but there is no user account under that username. Please try again. <br /><br />
Back to upload video form<br />
Back to Main Blog Page.</p>";
exit();
}
}
}
else
{
header("location:blog.php");
}
?>
<html>
<head>
<title>Test script</title>
</head>
<body>
<?php include("layout.php"); ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAXFILESIZE" value="2147483648" /><!--Equals to around 28 mb-->
ADD SCENE:
<input type="file" name='uploadfile' size="30" maxlength="100"/><br />
<input type= "submit" name="submit" value="UPLOAD"/>
</form>
</body>
</html>
/End of file/
Any help/insight would be appreciated. Thx!
It may be that your server has a size_limit for your server and you have to set that to the setting of your php upload script as well.
Check whether "file_uploads" is set to "On" and "upload_max_filesize" is more enough.