Доброго времени суток... возникла проблемка: есть форма add_menu | Код | <form id="new_menu" method="post"> <table> <tr><td class="style11 style5"> </td></tr> <tr><td class="style11 style5"> </td></tr> <tr> <td align="right" class="style11 style5">Краткий заголовок</td> <td><input type="text" size="54" id="title" name="title"></td> </tr> <tr> <td align="right" class="style11 style5">Подробный заголовок</td> <td><input type="text" size="54" id="long_title" name="long_title"></td> </tr> <tr> <td align="right" class="style11 style5">Описание</td> <td><textarea id="short_info" name="short_info" rows="3" cols="40"></textarea> </td> </tr> <tr> <td align="right" class="style11 style5">Изображение</td> <td><input type="file" size="43" id="img_path" name="img_path" onchange="alert(document.getElementById('img_path').value);" ></td> </tr> <tr><td class="style11 style5"> </td></tr> <tr> <td> </td> <td align="center"> <a href="javscript:void(0);" class="style10 style4" onclick="showSaveMenu(document.getElementById('title').value,document.getElementById('long_title').value,document.getElementById('short_info').value,document.getElementById('img_path').value);">Добавить</a> <a href="javscript:void(0);" class="style10 style4" onclick="showEditMenu();">Отменить</a> </td> </tr> </table> </form>
|
на которой загружается картинка и обработчик куда пересылаются параметры: | Код | <?php if(isset($_POST['title']) && isset($_POST['long_title']) && isset($_POST['short_info']) && isset($_POST['img_path']) ){
if (isset($_FILES['img_path'])) // file was send from browser { if ($_FILES['img_path']['error'] == UPLOAD_ERR_OK) // no error { $dest = 'upload/'.$_FILES['img_path']['name']; // file name move_uploaded_file($_FILES['img_path']['tmp_name'], '../'.$dest); echo "<br>pppppppppppppppppppppppppppppppppppp $dest"; // main action -- move uploaded file to $upload_dir } else echo 'Unknown error $dest'; }
echo "када же это кончится"; echo "<br>".$_POST['title']."_".$_POST['long_title']."_".$_POST['short_info']."_".$_POST['img_path'];
require_once('../mysql.php'); mysql_query("insert into menu (title,long_title, short_info,img_path) values('".trim($_POST['title'])."','".trim($_POST['long_title']). // "','".trim($_GET['short_info'])."',$dest )"); } else echo trim($_POST['img_path'])."ggggggggggg"; //include('option_menu.php'); ?>
|
пересылаю скриптом content_admin.js функция showSaveMenu: | Код | function showContent(menu,page) { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="item_content.php"; url=url+"?menu="+menu; url=url+"&npage="+page; xmlHttp.onreadystatechange=function(){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("main_frame_admin").innerHTML=xmlHttp.responseText; } }; xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function showMenu() { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="menu.php"; xmlHttp.onreadystatechange=function(){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("menu_content").innerHTML=xmlHttp.responseText; } }; xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function showEditMenu() { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="add_menu.php"; xmlHttp.onreadystatechange=function(){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("main_frame_admin").innerHTML=xmlHttp.responseText; } }; xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function showSaveMenu(title,long_title,short_info,img_path) { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="save_menu.php"; url=url+"?title="+title+"&long_title="+long_title; url=url+"&short_info="+short_info+"&img_path="+img_path; xmlHttp.onreadystatechange=function(){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("main_frame_admin").innerHTML=xmlHttp.responseText; } }; xmlHttp.open("POST",url,true); xmlHttp.send(null); }
function SetStateMenu(state,menu) { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="edit_state_menu.php"; url=url+"?menu="+menu; url=url+"&state="+state; xmlHttp.onreadystatechange=function (){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("main_frame_admin").innerHTML=xmlHttp.responseText; } }; xmlHttp.open("GET",url,true); xmlHttp.send(null); showMenu; }
function showOptionMenu() { var xmlHttp=GetXmlHttpObject(); if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="option_menu.php"; xmlHttp.onreadystatechange=function (){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("main_frame_admin").innerHTML=xmlHttp.responseText; document.getElementById("menu_content").innerHTML='sdfsdfadf'; } }; xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function GetXmlHttpObject() { var xmlHttp=null; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch (e){ //Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
|
сама проблема: $_Files['img_path'][name] не установлена , поэтому не могу аплоадить... подскажить пожалуйста что неверно... заранее благодарен....
|