|
請問我照著CH08做 是自己另開頁面製作 插入資料到alubmphoto OK 更新記錄 OK 刪除OK
但是為什麼檔案或圖片檔無法正確上傳至資料夾
<script src="jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="ajaxupload.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ new AjaxUpload('upbtn1', {action: 'edupload.php',data: {uploaddir : 'photos/'},onComplete: function(file, response){document.getElementById('pu1').value=file;}}); }); </script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ new AjaxUpload('upbtn2', {action: 'edupload.php',data: {uploaddir : 'photos/'},onComplete: function(file, response){document.getElementById('pu2').value=file;}}); }); </script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ new AjaxUpload('upbtn3', {action: 'edupload.php',data: {uploaddir : 'photos/'},onComplete: function(file, response){document.getElementById('pu3').value=file;}}); }); </script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ new AjaxUpload('upbtn4', {action: 'edupload.php',data: {uploaddir : 'photos/'},onComplete: function(file, response){document.getElementById('pu4').value=file;}}); }); </script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ new AjaxUpload('upbtn5', {action: 'edupload.php',data: {uploaddir : 'photos/'},onComplete: function(file, response){document.getElementById('pu5').value=file;}}); }); </script>
edupload.php(我沒變更)
<?php $uploaddir = $_POST['uploaddir']; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "success"; } else { // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE! // Otherwise onSubmit event will not be fired echo "error"; } ?>
請問我那裡做錯或那裡遺漏了呢? |