function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Angello Camacho DragoAngello Camacho Drago 

Delete document after download through visualforce page

I created a visualforce page with a button to download a document, this work fine, but after download the document I want to delete the file without to click in another button, this is the code I am using:

<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" action="{!getFile}" tabStyle="Reporte_Compromisos__tab">    
    <apex:form >
        <apex:actionFunction name="download" action="{!downloadFile}"/>
        <apex:actionFunction name="deletef" action="{!deleteFile}" rerender="name"/>
        <apex:pageBlock id="page">
            <apex:pageBlockSection columns="1" title="Descargar Archivo de Cobranza" collapsible="false">
                <apex:pageBlockSectionItem >
                    <apex:image url="{!$Resource.excelIcon}" width="30" height="30"/>
                    <apex:outputText id="name" value="Archivo {!fileName}"/>                    
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:CommandButton value="Descargar Archivo" action="{!downloadFile}" oncomplete="deletef();" rerender="name"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

The oncomple method doesn't work, can some one help me please?

Thanks.