我的网络应用程序中有一个像这样的控制器:
/**
* Disconnects an established connection, or cancels a connection attempt
* currently in progress.
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission.
*/
public void disconnect() {
if (DBG) Log.d(TAG, "cancelOpen() - device: " + mDevice.getAddress());
if (mService == null || mClientIf == 0) return;
try {
mService.clientDisconnect(mClientIf, mDevice.getAddress());
} catch (RemoteException e) {
Log.e(TAG,"",e);
}
}
如何将我的代码更改为具有下载文件的功能,而不在Web浏览器中打开文件?
答案 0 :(得分:0)
像这样吗?
def download_xml(request):
xml = f.open(xml_file, "r")
resp = HttpResponse(xml,
mimetype = 'text/xml'
)
resp['Content-Disposition'] = 'attachment; filename=file.xml'
return resp