We made a Java Servlet which takes 3 parameters and upload files from source path to remote path. The three parameters are password, source path and destination path.
When we run this command
http://localhost:8080/FTPSClientServ/uploader?password=xxxxxx&local=D:\xampp\htdocs\ews \nyc\data\&remote=/Vanguard/fromVanguard/msd/on http browser it works perfectly fine and gives http response.
Now i want to run this commmand in php document. I tried to execute that command in php document by making an ajax call it returns status 200 but along with it it gives an exception and does not give the http response.
The exception is
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/ews/nyc/test.php :: getGridlist :: line 43" data: no]Here is my code
Expand|Select|Wrap|Line Numbers
- <?php
- define("DESTINATION_PATH","/Vanguard/fromVanguard/msd/");
- $spassword = "xxxxxxx";
- ?>
- <!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=utf-8" />
- <title>NYC</title>
- <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
- <script type="text/javascript">
- var objXMLHttp;
- function GetXmlHttpObject(){
- objXMLHttp=null;
- try{
- // Firefox, Opera 8.0+, Safari
- objXMLHttp=new XMLHttpRequest();
- }
- catch (e){
- // Internet Explorer
- try{
- objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e){
- try{
- objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e){
- jAlert('Please upgrade your browser','No AJAX Support');
- return false;
- }
- }
- }
- return objXMLHttp;
- }
- var src_path="D:\\xampp\\htdocs\\ews\\nyc\\data\\";
- var xmlGridList=null;
- function getGridlist(){
- xmlGridList=GetXmlHttpObject();
- url="http://localhost:8080/FTPSClientServ/uploader?password=<?=$spassword;?>&local="+src_path+"&remote=<?=DESTINATION_PATH;?>";
- xmlGridList.open('GET', url, false);
- xmlGridList.onreadystatechange = $makeGrid;
- xmlGridList.send();
- }
- function $makeGrid(){
- if(xmlGridList.readyState==4){
- if(xmlGridList.status==200){
- alert(xmlGridList.responseText);
- }else{
- alert('An error occoured on the server the details are below <br />'+xmlGridList.status+' '+xmlGridList.statusText);
- }
- }
- }
- </script>
- </head>
- <body onload="javascript:getGridlist();"></body>
- </html>
Awaiting of your response.
Thanks in Advance,
Mohsin Rafique