Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Skylark » delete the file from the skylark/server after download (how to know if the file was sent "by the server" and delete it!)
delete the file from the skylark/server after download [message #58861] Sun, 18 September 2022 23:57
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
Hi,

is there any method in skylark that runs e.g. delete the file after the download has finished?



    //file download.icpp    --> this operation works fine!

    SKYLARK(dwn, "download:POST")
    {  
       	String f="C:\\Users\\my\\Downloads\\rProdx.pdf";
        FileIn fi(f);
	String fn=GetFileNamePos(f); 
	                                                               //--> applicaton/pdf it's already set in my ajax!    
        String x= "attachment; filename=\"" + fn +"\"";
	ttp.SetHeader("Content-Disposition", "attachment;filename=\"" + fn +"\"" ).ContentType("application/pdf") <<  LoadFile(f);
    }



something like this ...

   
    SKYLARK(Adwn, "Afterdownload")
    {  
          .....
          .....
          String fn="c:\\temp\\test.pdf";
          FindFile f(fn);

          if(f.IsFile()){

               bool b= DeleteFile(fn);       

            LOG( "file deleted: " << b << EOL );
          }else{
              
            LOG( "file not found! " << EOL );                           
          }
          
    }



Thanks!


Previous Topic: Proposition: Adding a way to send huge file via stream in skylark
Next Topic: Suport for OPTIONS request
Goto Forum:
  


Current Time: Wed Jun 12 20:34:04 CEST 2024

Total time taken to generate the page: 0.02439 seconds