我有管理面板,我在其中插入数据和上传文件,当我点击插入按钮时,它给出错误,如“您正在查找的资源存在问题,并且无法显示“。我已经在PHP Dreamweaver中创建的远程服务器上传了我的管理面板为什么它的幸福我不知道请帮忙。我想在该服务器上插入数据和文件上传。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<?php
include('header1.php');
?>
<!-- Javascript -->
<script type="text/javascript">
$(function() {
//var currentDate = new Date();
$( "#datepicker-7" ).datepicker({
defaultDate:+9,
dayNamesMin: [ "Sun", "Mon", "Tue", "Wed", "Thurs", "Fri", "Sat" ],
duration: "slow",
dateFormat: 'dd/mm/yy'
});
//$("#datepicker").datepicker("setDate", currentDate);
});
function madeSelection(elem,helpermsg,e)
{
if(elem.value=="---Select---")
{
alert(helpermsg);
elem.focus();
e.preventDefault();
return false;
}
}
function validateFileExtension(fld,FieldName)
{
if(!/(\.txt|\.pdf)$/i.test(fld))
{
varError = varError + FieldName + "Invalid text file type.\n";
return false;
}
return true;
}
</script>
</head>
<body >
<?php
include('sidenav.php');
?>
<div id="page-wrapper" >
<div id="page-inner">
<div class="row">
<div class="col-md-12">
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
echo"<h2>Update Product</h2>";
}
else
{
echo"<h2>Add Product</h2>";
}
?>
</div>
</div>
<!-- /. ROW -->
<hr />
<div class="row">
<?php
include('config.php');
if(isset($_GET['id']))
{
$id = $_GET['id'];
if(isset($_POST['submit']))
{
echo"Upload Only PDf File";
$fileName=$_FILES["filepdf"]["name"];
$fileSize=$_FILES["filepdf"]["size"]/2024;
$fileType=$_FILES["filepdf"]["type"];
$fileTmpName=$_FILES["filepdf"]["tmp_name"];
if($fileType=="application/pdf")
{
if($fileSize<=200)
{
$random=rand(1111,9999);
$newFileName=$random.$fileName;
$uploadPath="testUpload/".$newFileName;
if(move_uploaded_file($fileTmpName,$uploadPath))
{
echo "Successful<BR>";
echo "File Name :".$newFileName."<BR>";
echo "File Size :".$fileSize." kb"."<BR>";
echo "File Type :".$fileType."<BR>";
}
else
{
echo "Maximum upload file size limit is 200 kb";
}
}
else
{
return false;
echo "You can only upload a pdf file.";
}
$updt=mysql_query("update product set pdf='$newFileName' where id='$id'");
}
$updates = isset($_POST['updates']) ? 'Yes' : 'No';
$cat=$_POST['catnm'];
$prodnm=$_POST['prodnm'];
$prod_dtl=$_POST['prod_dtl'];
//$downld=$_POST['downld'];
$date=$_POST['date'];
if(isset($_POST['filepdf'])) {
$query3=mysql_query("update product set catnm='$cat', prodnm='$prodnm',prod_dtl='$prod_dtl'
,downld='$updates',date='$date' where id='$id'");
}
else
{
$query3=mysql_query("update product set
catnm='$cat',prodnm='$prodnm',prod_dtl='$prod_dtl'
,downld='$updates',date='$date' where id='$id'");
}
if($query3||$updt)
{
header('location:addProduct.php');
}
}
$query1=mysql_query("select * from product where id='$id'");
$query4=mysql_fetch_array($query1);
//echo "<pre>";
//print_r($query4);
}
else
{
if(isset($_POST['submit']))
{
echo"Upload Only PDf File";
$fileName=$_FILES["filepdf"]["name"];
$fileSize=$_FILES["filepdf"]["size"]/2024;
$fileType=$_FILES["filepdf"]["type"];
$fileTmpName=$_FILES["filepdf"]["tmp_name"];
if($fileType=="application/pdf")
{
if($fileSize<=200){
//New file name
$random=rand(1111,9999);
$newFileName=$random.$fileName;
//File upload path
$uploadPath="testUpload/".$newFileName;
//function for upload file
if(move_uploaded_file($fileTmpName,$uploadPath))
{
echo "Successful<BR>";
echo "File Name :".$newFileName."<BR>";
echo "File Size :".$fileSize." kb"."<BR>";
echo "File Type :".$fileType."<BR>";
}
else
{
echo "Maximum upload file size limit is 200 kb";
}
}
else
{
return false;
echo "You can only upload a pdf file.";
}
echo "here downld";
$updates = isset($_POST['updates']) ? 'Yes' : 'No';
$catnm=$_POST['catnm'];
$prodnm=$_POST['prodnm'];
$prod_dtl=$_POST['prod_dtl'];
//$updates=$_POST['downld'];
$date=$_POST['date'];
$query=("insert into product(catnm,prodnm,prod_dtl,pdf,downld,date)
values('$catnm','$prodnm','$prod_dtl','$newFileName','$updates','$date')");
$result = mysql_query($query,$conn);
if($result)
{
header('location:addProduct.php');
}
}
}
}
?>
<div class="col-md-6 col-sm-12 col-xs-12">
<div class="panel-body">
<label>Select Category:</label>
<div class="form-group">
<?php
include('config.php');
$query1=mysql_query("select catnm from category");
?>
<select class=form-control m-b-10 name=catnm id=catnm >
<?php
echo"<option>---Select---</option>";
while($query=mysql_fetch_array($query1))
{
$selectedCat = '';
if($query[catnm] == $query4['catnm'])
{
$selectedCat = "selected";
}
echo "<option value='$query[catnm]'
$selectedCat >$query[catnm]</option>";
}
?>
</select>
<br/>
<div class="form-group">
<input type="text" class="form-control" id="prodnm" placeholder="Product
Name" name="prodnm" required value="<?php if(isset(
$query4['prodnm'])){
echo $query4['prodnm'];}?>"/>
</div>
<div class="form-group">
<textarea class="form-control" id="catdtl" name="prod_dtl"
placeholder="Product Detail" "rows="10" cols="62" required><?php
if(isset($query4['prod_dtl'])){echo $query4['prod_dtl'];} ?></textarea>
</div>
<div class="form-group">
<label for="exampleInputFile">PDF File</label>
<input type="file" id="exampleInputFile" accept="application/pdf"
name="filepdf" >
<?php if(isset($query4['pdf'])){
echo $query4['pdf'];} ?>
</div>
<div class="checkbox">
<label>
<input id="checkbox" type="checkbox" name="updates"
<?php if(isset($query4['downld'])) { if($query4['downld'] == 'Yes')
echo "checked='checked'"; echo $query4['downld'];}
?> /> Is Downloadable <br />
</label>
</div>
<input type="text" placeholder="Date of Upload" name="date" value="
<?php if(isset($_GET['id'])){$id = $_GET['id'];echo
$query4['date'];}else{
echo date('d/m/Y');>"id="datepicker-7">
<div style="padding-top:20px;padding-bottom:40px;width:650px;">
<input type="submit" name="submit" id="button"
onclick="madeSelection(document.getElementById('catnm'),'Please Select
Category',event)" value="<?php if(isset($_GET['id'])){$id =
$_GET['id'];echo"Update";}else{echo"Submit";}?>"/>
<input type="button" value="cancel" onclick="window.location='index.php'"/>
<hr/>
</form>
</div>
<!-- /. ROW -->
</div>
<!-- /. PAGE INNER -->
</div>
<!-- /. PAGE WRAPPER -->
</div>
</body>
</html>