dio
dio copied to clipboard
Flutter Web: Read filename from Headers
Is there anyway to get the filename from Content-Disposition headers aside from specifying a filename for Web?
try this:
await dio.download(
url,
(HttpHeaders headers){
// parse `content-disposition ` here
return "$filename"
},
);
I already found this answer in the issue https://github.com/flutterchina/dio/issues/258. Unfortunately, this method is not supported for web
https://github.com/flutterchina/dio/blob/ac78e6151e1736f945cb9b215bbcfac230e19cf1/dio/lib/src/dio_mixin.dart#L362
it doesn't solve my problem.
try this:
await dio.download( url, (HttpHeaders headers){ // parse `content-disposition ` here return "$filename" }, );
@riccardopirani Do you have a specific code?
Use HEAD
request instead of download
.