0

During Downloading files the size is unknown "0B" despite having set the "Content-Length" headers with the bytes (see $http_headers below)

Content-Type (String, 15 characters ) application/zip
Content-Disposition (String, 55 characters ) attachment; filename="test.zip"
Content-Length (Integer) 454732390
Pragma (String, 8 characters ) no-cache

FYI - code for file transfer (using Taxonomy File Tree)

$file = file_load($node->tft_file[LANGUAGE_NONE][0]['fid']);
    $http_headers = array(
      'Content-Type' => $file->filemime,
      'Content-Disposition' => 'attachment; filename="' . $file->filename . '"',
      'Content-Length' => filesize($file->uri),
    );
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
      $http_headers['Cache-Control'] = 'must-revalidate, post-check=0, pre-check=0';
      $http_headers['Pragma'] = 'public';
    }
    else {
      $http_headers['Pragma'] = 'no-cache';
    }

file_transfer($file->uri, $http_headers);

Is the format wrong or am I missing something?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.