I am trying integrate an upload system from YouSendIt.com in to my companies forms. The code they give for integration is basically an iframe with a coded URL set for the source. Their server sends a postback using HTTP Post method but I am not sure how to access the data that is sent back. I do not need to display it but I need to use it for validation purposes in the rest of my form. The Iframe code is as such:

<iframe style="margin-left:20px;background-color:#ffffff;overflow-x:hidden;display:block" id="file_upload_iframe" name="file_upload_iframe" src="https://www.yousendit.com/v1/ibox.php?sitebox=1011503&sh=adeace4e28613bc36fb1fa3c6ef766ee&send_notification=false&custom_postback=true" width="600" height="250" marginwidth="0" align="middle" frameborder="0" allowtransparency="true"></iframe>

From what I gather online I need to use AJAX to acquire the data but I am not familiar with AJAX. I am familiar with PHP but I am not sure how to acquire the data through that either. The example they provide of the data that is sent back is as follows:

xml_response->
<ysi-response xmlns=\'http://www.yousendit.com/xml/ns/\' >
<interface name=\'UploadStatus\'>
<ibox_info>
  <request_param>request_param>
ibox_info>
<batch_info>
  <batch_id>batch_id>
  <batch_name>batch_name>
  <client_IP>client_IP>
  <status>status>
  <batch_download_link>batch_download_link>
batch_info>
<file_info>
  <file_name>file_name>
  <file_size>file_size>
  <date_uploaded>date_uploaded>
  <file_download_link>file_download_link>
file_info>
interface>
ysi-response>

Lastly, the page does not refresh or redirect after the upload process. If anyone can help at all it would be greatly appreciated.

Ajax is just a JavaScript. If you know JavaScript, Ajax would be just another library you use. You can use w3school website tutorial. It looks fine to me. But if you want to get deeper, search on the Internet for more information.

Ajax can deal with both xml and text. So yes, you would want to use Ajax for your solution.

Ajax is just a JavaScript. If you know JavaScript, Ajax would be just another library you use. You can use w3school website tutorial. It looks fine to me. But if you want to get deeper, search on the Internet for more information.

Ajax can deal with both xml and text. So yes, you would want to use Ajax for your solution.

Thank you for the reply. I have looked over some AJAX tutorials and I see how to connect to an XML file in order to access the data, but what i do not know is how to access this postback data that I am not aware of the file name or how it is hitting the server. Is there a way to keep a stream open for this data when it arrives to my page?

Ok, below is what I have been able to come up with for accepting the HTTP response being sent by YouSendIt.com's server. Obviously it is not working, can anyone tell me why? Thank you to everyone who has viewed my post for trying.

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  
xmlhttp.onreadystatechange=function() {
  
  if (xmlhttp.readyState==4 && xmlhttp.status==200) {
  	
	xmlDoc=xmlhttp.responseXML;

	x=xmlDoc.getElementsByTagName("file_name");

	document.getElementById("myDiv").innerHTML=x;


	}
}

This code, for now, should just populate the DIV of "myDiv" with file name of the uploaded file. This will not be the final use of the data but I am just trying make sure that I am pulling the correct data.

Ok, below is what I have been able to come up with for accepting the HTTP response being sent by YouSendIt.com's server. Obviously it is not working, can anyone tell me why? Thank you to everyone who has viewed my post for trying.

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  
xmlhttp.onreadystatechange=function() {
  
  if (xmlhttp.readyState==4 && xmlhttp.status==200) {
  	
	xmlDoc=xmlhttp.responseXML;

	x=xmlDoc.getElementsByTagName("file_name");

	document.getElementById("myDiv").innerHTML=x;


	}
}

This code, for now, should just populate the DIV of "myDiv" with file name of the uploaded file. This will not be the final use of the data but I am just trying make sure that I am pulling the correct data.

I figured out how to access this info easily through PHP, thanks to everyone who viewed and posted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.