This topic is locked

Export File Name

7/11/2011 4:07:03 AM
PHPRunner General questions
S
swanside author

Hi there.
In my job table when we export, it saves it as job.xml
In my job table I have a field called File_No which is unique to the job. Can I export the xml as the file number?
So instead of it looking like job.xml, it would be the File_No.xml from the File_No field? as this would prevent the odd user overwritting the previous export?
Cheers

Paul.

C
cgphp 7/11/2011

A solution may be the following:

  1. Open the job_export.php file (This file is generated after you have built the project)
  2. Search this line:

header("Content-Disposition: attachment;Filename=job.xml");



3. Substitute it with this code:

$sql = "select File_No from job where id = 1"; // change this query according to your needs

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

header("Content-Type: text/xml");

header("Content-Disposition: attachment;Filename=".$data['File_No'].".xml");