diff options
author | Sashi20 | 2021-09-08 17:24:57 +0530 |
---|---|---|
committer | GitHub | 2021-09-08 17:24:57 +0530 |
commit | 3cc55a7692074b8b091b7476573476860e65f4fe (patch) | |
tree | 8e1b08e7d025cc02e5f2d480203be9383d1fbc18 /download.inc | |
parent | 400c7d35e7fe3a819a005b651f371902895f2e56 (diff) | |
parent | 5d34b8eda7e2766baacc654eb1e10f439cb69112 (diff) | |
download | r_lab_migration-3cc55a7692074b8b091b7476573476860e65f4fe.tar.gz r_lab_migration-3cc55a7692074b8b091b7476573476860e65f4fe.tar.bz2 r_lab_migration-3cc55a7692074b8b091b7476573476860e65f4fe.zip |
Merge pull request #9 from Saketh1499/development
Updating country fields in proposal form
Diffstat (limited to 'download.inc')
-rwxr-xr-x | download.inc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/download.inc b/download.inc index d95c5a2..04fd147 100755 --- a/download.inc +++ b/download.inc @@ -281,3 +281,25 @@ function lab_migration_download_lab() drupal_goto('lab-migration/lab-migration-run'); } } +function lab_migration_download_syllabus_copy() +{ + $proposal_id = (int)arg(3); + $root_path = lab_migration_path(); + $query = db_select('lab_migration_proposal'); + $query->fields('lab_migration_proposal'); + $query->condition('id', $proposal_id); + $query->range(0, 1); + $result = $query->execute(); + $syllabus_copy_file_data = $result->fetchObject(); + $syllabus_copy_file_name = substr($syllabus_copy_file_data->syllabus_copy_file_path, strrpos($syllabus_copy_file_data->syllabus_copy_file_path, '/') + 1); + error_reporting(0); //Errors may corrupt download + ob_start(); //Insert this + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-disposition: attachment; filename="' . $syllabus_copy_file_name . '"'); + header('Content-Length: ' . filesize($root_path . $syllabus_copy_file_data->syllabus_copy_file_path)); + ob_clean(); + ob_end_flush(); + readfile($root_path . $syllabus_copy_file_data->syllabus_copy_file_path); + exit; +}
\ No newline at end of file |