php - Download file in mobile device -
I downloaded the PC device to the following code
$ file_url_source = " C: /test.xlsx "; $ File_url = "C: /test.xlsx"; Header ('Content-Type: Text / Jason; Charset = UTF-8;'); Header ('content-description: file transfer'); Header ('content-type: application / octet-stream'); Header ('content-dispute: attachment; filename =' '.bessname ($ file_url_source). "").' ''; '; Header ('content-transfer-encoding: binary'); Header ('expiration: 0'); Header ('Cash-Control: Required-Modified, Post Check = 0, Pre-Check = 0'); Header ('pragma: public'); Header ('content-length:'. Filesystem ($ file_url)); Ob_clean (); Flush (); Readfile ($ FILE_URL);
But this is not working for mobile device (I just test in android mobile and it downloads the download.php
file). How can I download files to mobile devices?
You only need it:
$ file_url = " Xxxxxx "; Header ('content-type: application / force-download'); Header ('content-dispute: attachment; filename =' '. Bassname ($ file_url).' '' '); Readfile ($ FILE_URL);
Your problem is with this line
header ('content-dispute: attachment; filename =' '. Basnem ($ file_url_source). "" ). ''; '; # ^^^^^^^^^ # This is your problem, where you never put the last "file name around
Comments
Post a Comment