tags:

views:

41

answers:

2

Hi - thanks for clicking.

I am trying to get status feedback using an IFrame for file uploads. I am not trying to get progress or percentages - just when a file is done uploading and if it was a success or failure.

THE PROBLEM is that I can't seem to get the server response to appear on the client. I have to following design:

I have an iframe on my page:

 <iframe id="target_frame" src="" style="border:0px; width:0px; height:0px"></iframe>

The form tag points to it:

<form enctype="multipart/form-data" id="fileUploadForm" name="fileUploadForm" action="picupload.aspx" method="post" target="target_frame">

And the submit button starts a file upload via the iframe:

<input id="submit" type="submit" value="upload" />

In the picupload.aspx.cs file, I have a method that returns dynamic data. I then send it to the client:

message = data;
Response.Write(String.Format("<script language='javascript' type='text/javascript'>window.parent.handleResponse('{0}');</script>", message));

On the client, I have a response handler:

 function handleResponse(msg) {
        document.getElementById('statusDiv').innerHTML = msg;
  }

My intent is to see the msg value change for each uploaded file but I never see anything appear in statusDiv, let alone dynamically changing messages.

Can somebody please help??

A: 

Until you provide more code, I can only guess at the issue. I would first check to make sure that the iframe page (picupload.aspx.cs) is host on the same domain as the page that contains the iframe.

Justin Johnson
Thanks Justin. Yep, same domain. I just realized i needed to add the "code" wrapper so people could view my code. Let me know if you want to see something else...
Code Sherpa
A: 

Hope this helps:

http://www.nbsp.es/2007/11/23/up-libreria-para-subir-archivos-de-forma-oculta/

Help is in spanish, but the code is there.

Marc