rush Posted May 11, 2006 Share Posted May 11, 2006 Hi,I have created an extension with firefox which will work as a quick image upload tool for my image server.Now the issue is my server needs to have some supporting php scripts for this to work. Can someone help me on this..??thanks for readingThe actual javascript is this:[code]window.addEventListener("load", initOverlay, false);var didit = 0;function initOverlay() { var menu = document.getElementById("yourFiles"); menu.addEventListener("popupshowing", contextPopupshowing, false);}function contextPopupshowing() {if (didit==1) { return false; }var xmlhttp;xmlhttp = new XMLHttpRequest();xmlhttp.open("GET", "http://***.***.com/emyfiles.php",true);xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { doList(xmlhttp.responseText); }}xmlhttp.send(null);}function doList(data) {var files=data.split("\n");var fields;var uid;var fname;var output="";var incat = document.getElementById("yourFiles");for (var i=0; i < files.length -2; i++ ) { fields=files[i].split("\t"); uid = fields[0]; fname = fields[1]; output += i + ": <a href=\"http://***.***.com/files/" + uid + "/" + fname + "\">" + fname + "</a><br />\n"; var ja = document.createElement("menuitem"); ja.setAttribute("label",fname); ja.setAttribute("oncommand","gotourl(\"http://***.***.com/detail.php?id=" + uid + "\");"); incat.childNodes[0].appendChild(ja);}didit=1;}function gotourl(url) {const newTab = getBrowser().addTab(url);getBrowser().selectedTab = newTab;generatedPage = window;}// This is my javascript, which will pop up my message// in an alert box.var hush = {loadSite: function(mode) {gotourl('http://***.***.com');return false;},loadLink: function(mode) {var url = 'test';if (mode == 1) { url = gContextMenu.linkURL();}if (mode == 2) { url = gContextMenu.imageURL;}if (url == '' || url == 'undefined' || url=='Undefined') { if (mode == 1) { window.alert('Please select a link'); return false; } if (mode == 2) { window.alert('Please select an image'); return false; }}gotourl('http://***.***.com/process.php?remotefile=' + url);return false;}[/code]Someone please help, thanks Quote Link to comment https://forums.phpfreaks.com/topic/9540-need-help-with-php-scripts/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.