flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Downloader not working for dynamic zip / generated zip download [file getting download at specified path but it is corrupted. ]. Direct zip link it is

Open tusharuit25 opened this issue 4 years ago • 5 comments

I am using flutter_downloader in conjuction with flutter_inappwebview

                            filePath =
                                (await getExternalStorageDirectory()).path;
                            print("onDownloadStart $url and path $filePath");

                            final taskId = await FlutterDownloader.enqueue(
                              fileName: "offlineaadhaar.zip",
                             // headers: {"Content-Type":"application/octet-stream"},
                              url: url.toString(),
                              savedDir: filePath,
                              showNotification: true,
                              // show download progress in status bar (for Android)
                              openFileFromNotification:
                                  true, // click on notification to open downloaded file (for Android)
                            );
                            print("on Download Task Id: $taskId")
                          },

file getting download at specified path but it is corrupted.

tusharuit25 avatar Apr 05 '21 07:04 tusharuit25

image

tusharuit25 avatar Apr 05 '21 07:04 tusharuit25

https://github.com/fluttercommunity/flutter_downloader/issues/43 i seen this part as my solution but here zip file is direct link not the generated and sent over response.

tusharuit25 avatar Apr 05 '21 09:04 tusharuit25

When I closely look at the file downloaded its downloading html page.

tusharuit25 avatar Apr 05 '21 10:04 tusharuit25

tried all header

              ```
 final taskId = await FlutterDownloader.enqueue(
                          fileName: "offlineaadhaar20210405043704081.zip",
                          headers: {
                            "Cache-Control":
                                "no-store, no-cache, must-revalidate, post-check=0, pre-check=0",
                            "Connection": "Keep-Alive",
                            "Content-Disposition":
                            "attachment; filename=offlineaadhaar20210405043704081.zip",
                            //"Content-Length": "-1",
                            "Content-Transfer-Encoding": "Binary",
                            "Content-Type": "application/zip",
                            "X-Content-Type-Options": "nosniff",
                            "X-Frame-Options": "sameorigin",
                            "X-XSS-Protection": "1;mode=block"
                          },
                         url: url.toString(),
                          savedDir: filePath,
                          showNotification: true,
                          // show download progress in status bar (for Android)
                          openFileFromNotification:
                              true, // click on notification to open downloaded file (for Android)
                        );

tusharuit25 avatar Apr 05 '21 11:04 tusharuit25

Any updates on this ??

WaheedHussainHaans avatar Jan 20 '22 03:01 WaheedHussainHaans