Using in an iFrame

Mar 16, 2009 at 4:46 AM
Hello - Has anyone used this in an iFrame yet?

My client wants me to use this on a classic ASP page, so I have an iFrame containing a control that has the Flajaxian Uploader and my custom adapter.

It works great except I can't monitor the file change event because I think I am out of scope when the uploader is running.

I basically have this button on my ASP page after the iFrame:

<input id="btnUpload" type="submit" value="Continue" runat="server" onclick="window.frames['IFR'].StartFileUpload()" />

Then my iFrame source points to my user control that has this:

        <fjx:FileUploader ID="FileUploader1" UploadButtonX="-300" JsFunc_FileStateChanged="FileStateChanged" JsFunc_GenerateFileRow="GenerateFileRow" MaxNumberFiles="1" runat="server"
                <cust:ImageUploadLoggingAdapter Runat="server" FolderName=".\photos"/>

The script block on the control page:

<script type="text/javascript">
function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    alert("I am here");
   // if file is uploaded (file.state == 3) or if there is an error (file.state == 5)
    if(file.state > Flajaxian.File_Uploading && isLast){
        alert("File is done");

function  StartFileUpload(){

When I run this i works like a champ, I can select my file and use my ASP button to call the StartFileUpload from the parent document.  When the file is done uploading however, I can't even display the "I am here" alert box.

Sorry if this is a stupid javascript scope question - just was hoping someone on this forum is doing something similar.


Eric McEntee

Mar 16, 2009 at 8:12 PM
This was my file - in the declaration for the fileuploader I had this:

JsFunc_FileStateChanged="FileStateChanged" JsFunc_GenerateFileRow="GenerateFileRow"

I needed to remove the GenerateFileRow event and it works fine now.

Mar 17, 2009 at 5:10 AM
Thanks for letting us know. this maybe useful for some others that are using this in Iframes