dimanche 26 juillet 2015

Downloading an SQlite .db file

Hello currently I am working on a tool that converts an otherwise file-based stored text array(not really important though what it does). It works great and I am able to download and use it if I download the file off the FTP, but when I try to directly download it to the person using the .php file, it says Invalid file. My current code is:

        header('Content-type: application/db');
        header("Content-Length: " . filesize($dbname));
        header("Content-Disposition: attachment; filename=$dbname");

What is the issue? Is the content-type or something else wrong? Or should I be using readfile(I tried this?)

When I download with the above code, the name of the file seems to be correct or whatever but when I attempt to open it with the SQLite3 Browser(it works when I download directly off the FTP) the program displays "Invalid file format". When I use readfile it downloads as "download" with no file extension and when I attempt to open windows says Invalid file. Any help would be awesome.

Aucun commentaire:

Enregistrer un commentaire