我正在使用一個代碼!這裏表單中的每個字段都上傳,除了文件(照片)字段。有人可以幫忙嗎?我一直在使用相同的代碼。我已經創建了上傳圖片所需的文件夾/照片/大拇指這裏是代碼!照片不上傳
<article class="col-md-8 body-box box-form">
<div class="body-form">
<h2 class="text-danger"> Upload Photos<h2>
<?php if(isset($photo->sysMessage)) { echo $photo->sysMessage; } ?>
<div class="col-md-8">
<form role="form" action="" method="post">
<div class="form-group">
<label>Category</label>
<select name="pht_pho_ID" class="form-control">
<option></option>
<?php $photo->optionCategories(); ?>
</select>
</div>
<!-- Javascript -->
<script>
init.push(function() {
$('#styled-finputs').pixelFileInput({ placeholder: 'No file selected...' });
})
</script>
<!--/Javascript -->
<div class="form-group">
<label>Photo</label>
<input type="file" name="pht_image" />
</div>
<div class="form-group">
<label>Title</label>
<input type="text" id="styled-finputs" name="pht_title">
</div>
<div class="form-group">
<label>Publish </label>
<input type="radio" class="form-control" value="1" name="pht_published">
Yes
</div>
<div class="form-group">
<input type="radio" class="form-control" value="0" name="pht_published">
No
</div>
<button type="submit" class="btn btn-danger" name="save">Submit</button>
</form>
</div><!-- end of col-md-6 -->
</div>
</article>
這裏是php文件
function add() {
// escape();
require_once('imageUpload.php');
$imageUpload = new imageUpload();
$upload = $imageUpload->uploadImageThumb($_FILES['pht_image']['name'], $_FILES['pht_image']['tmp_name'], 'uploads/photos/', 300, 300);
if($upload == 1) {
$qry = "INSERT INTO photos (pht_title, pht_pho_ID, pht_image, pht_published) VALUES ('$_POST[pht_title]', $_POST[pht_pho_ID], '$imageUpload->filename', $_POST[pht_published])";
if(mysql_query($qry)) {
$pht_ID = mysql_insert_id();
header('Location: photos-edit.php?arg=addSuccess&pht_ID='.$pht_ID) ;
}
else {
echo mysql_error();
}
}
else {
echo $upload;
}
}
什麼樣的調試過程中你經歷過? – 2014-10-30 16:11:12
好吧!我爲自己感到遺憾,我沒有使用任何調試工具!!其實我在網上做這個工作!我以前使用過它,它工作正常,但現在我不知道問題是什麼!!!它必須與文件上傳過程! – user2550011 2014-10-30 16:13:53