Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP: Passing International File Names Via PHP File Download Header Response To IOS Clients
    primarykey
    data
    text
    <p>Actually i am downloading the file from my ios app using ASIHTTPRequest Library. I want to pass the international characters(it's a file name) via php header response while downloading the file. Basically am creating the new custom header called "<strong>filename-display</strong>" while construction the file download header response.</p> <p><strong>Here my PHP code:</strong></p> <pre><code>&lt;?php $dir = 'c:\좋은 아침.pdf'; $filename_display = '좋은 아침.pdf'; if (file_exists($dir)) { header("HTTP/1.1 200"); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($dir)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('filename-display:' . $filename_display); header('Content-Length:' . filesize($dir)); ob_clean(); flush(); readfile($dir); exit; } else { header("HTTP/1.1 404 file not found"); echo 'file_not_exists'; exit(0); } ?&gt; </code></pre> <p><strong>Client Code ASIHTTPRequest Library Delegate calls:</strong></p> <pre><code>#pragma mark #pragma ASIHTTPREQUEST delegate methods -(void)requestStarted:(ASIHTTPRequest *)request{ NSLog(@"\n file download start"); } -(void)updateUploadProgress:(ASIHTTPRequest*)request { [request updateUploadProgress]; } - (void)requestFailed:(ASIHTTPRequest *)request { //handle it } - (void)requestFinished:(ASIHTTPRequest *)request { NSDictionary *responseHeaders = [request responseHeaders]; NSLog(@"\nresponse header dict = %@", responseHeaders); NSLog(@"\nfile name: %@", [responseHeaders objectForKey:@"filename-display"]); } </code></pre> <p><strong>Output on my ios app:</strong></p> <p>file name: ?????????.pdf instead of shows the actual file name configured on php header side.</p> <p>Let me know what encoding i can use on php side?. Also it's possible to pass the xml string via header response?. </p> <p>Any help that might me appreciated. </p> <p>-loganathan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload