Monday, September 23, 2013

download a file and save it to local disk

 download a file and save it to local disk
 
 
long fp;
 char *data;
 long prmLen;
 char fileName[50];
 int pdf_size;
-------
 web_set_max_html_param_len("2000000");
 
 web_reg_save_param_ex(
  "ParamName=sPrintPDF",
  "LB=",
  "RB=",
  LAST);
-----------------
   
sprintf(fileName, "C:\\Junk\\file_%s.pdf", lr_eval_string("{iterNo}"));
   fp = fopen(lr_eval_string(fileName), "wb");

 pdf_size = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );
 fwrite(lr_eval_string("{sPrintPDF}"),pdf_size,1,fp);
 fclose(fp);

No comments:

Post a Comment