Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author thomstark

    (@thomstark)

    Follow these steps for me:

    1. Open up in an editor: wpcontent/plugins/file-away/lib/js/management.js

    2. On line 1226, beneath FileUpConfig = []; add this line:

    FileUpInProgress = false;

    3. On line 1242, directly above the line that says: var TheFiles = []; add this function:

    $(window).on('beforeunload', function(){
        if(FileUpInProgress) return 'Uploads are in progress. Exiting the page will terminate any further uploads.';
    });

    4. On line 1439 – 1448, change this:

    if(k < TheFiles[uid].length)
    {
    	fileupAjax(TheFiles[uid][k], k, uid);
    }
    else
    {
    	$('span#ssfa_submit_upload_'+uid).parents('span.ssfa_fileup_wrapper').eq(0)
    		.css({'visibility':'visible','opacity':'1'});
    	TheFiles[uid] = [];
    }

    to this:

    if(k < TheFiles[uid].length)
    {
    	FileUpInProgress = true;
    	fileupAjax(TheFiles[uid][k], k, uid);
    }
    else
    {
    	FileUpInProgress = false;
    	$('span#ssfa_submit_upload_'+uid).parents('span.ssfa_fileup_wrapper').eq(0)
    		.css({'visibility':'visible','opacity':'1'});
    	TheFiles[uid] = [];
    }

    Save the file and you should be good to go.

    Thread Starter coxy17

    (@coxy17)

    I’ll give it a try thanks. If I change this then it will be overwritten when there’s a new update for your plugin?

    Plugin Author thomstark

    (@thomstark)

    I will include it, but it will probably be a while before there’s an update.

    Thread Starter coxy17

    (@coxy17)

    I have tried adding as per your instruction but when i go to select files to upload i can select a file and it doesn’t add it to the upload list? its blank? So cant upload files basically.

    I get no errors and have refreshed and cleared cache etc.

    Do you have the file i can download?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prevent user from leaving page whilst uploading files’ is closed to new replies.