Please help with IFrame callback

Posted by Code Sherpa on Stack Overflow See other posts from Stack Overflow or by Code Sherpa
Published on 2009-11-10T23:30:26Z Indexed on 2010/05/28 23:12 UTC
Read the original article Hit count: 220

Filed under:
|
|

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??

© Stack Overflow or respective owner

Related posts about wcf

Related posts about http