直接文件下载与将文件读回下载

发布于 2024-08-22 03:56:25 字数 443 浏览 14 评论 0原文

创建到服务器上文件的直接链接与执行从某个位置读取文件并设置内容类型标头然后流回数据之类的操作之间有什么区别吗?

我很好奇,因为我有一个网络服务器,我用它来将应用程序下载到黑莓上,如果我创建一个文件并有到该文件的直接链接,它就可以工作,但如果我使用网页将其流回,它就不会工作。手机获取文件但不起作用。

需要注意的是:

那么为什么手机会更喜欢实际上是直接链接的文件而不是在数据传输时将数据流回的控制器的文件和url是一样的吗?

Is there any difference between creating a direct link to a file on a server, and doing something like reading the file from a location and setting the content type header then streaming back the data.

I'm curious because I have a webserver that i'm using to download apps to a blackberry, if i create a file and have a direct link to that file it works, but if i stream it back using an webpage it doesn't work. The phone gets the file but it doesn't work.

Things to note:

So why would the phone prefer a file that's actually a direct link vs one that is a controller streaming the data back when the data transmitted and the url are identical?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

緦唸λ蓇 2024-08-29 03:56:25

.JAD 文件只是下载的第一部分 - 还有与之关联的 .COD 文件(在 JAD 中引用)。您是否确保您的“流式传输”方法正确并使用正确的 MIME 类型发回 COD 文件?

The .JAD file is just the first part of the download - there are also the .COD files associated with it (referenced in the JAD). Did you ensure that your "streaming" method is sending back the COD file correctly and with the correct MIME types?

聆听风音 2024-08-29 03:56:25

我发现了这个问题的解决办法,但我仍然不确定是什么原因造成的。我一直通过短信/电子邮件网关将链接发送到手机。当手机收到短信并且我选择下载链接时,它会询问我是否想要获取 jad,我点击“是”,它就会显示并退出。我将完全相同的链接作为 html 链接放在另一个页面上,并发送了一条指向该页面的短信。该网站抛出错误...所以我将链接复制并粘贴到手机浏览器中,页面显示得很好,我单击页面上的 jad 下载链接,现在 jad 工作正常。

所以我在想两件事,要么有某种安全机制可以防止短信中的直接链接(但这对其他文件有效),要么手机获取网址的方式不同。

我运行了一些测试,并在接受 id 值的页面上注意到了其他内容 (http://site.com/ download/145),其中 145 是文件的 ID,如果您在手机浏览器中转到该链接,它可以正常工作并下载该文件。如果您通过短信发送,服务器会出错,指出 id 应该是浮点数,并且它收到了一个字符串。那么为什么当手机直接从短信链接时,url 参数是字符串,但在浏览器中使用时,实际上会被解析为浮点数?

抱歉冗长的解释,但这是一个奇怪的问题。

I discovered a fix for this problem though I'm still not sure what causes it. I have been delivering the link to the phone through the sms/email gateway. When the phone gets the sms and I select the link for download it asks if i want to get the jad i hit yes and it shows up and drop out. I put the exact same link on another page as an html link and sent an sms pointing to that page. The web site throws an error... So I copied and pasted the link into the phones browser and the page shows up just fine, I click the jad download link on the page and now the jad works fine.

So i'm thinking two things either there is some sort of security mechanism that prevents direct links in sms(but this has worked for other files) Or the way the phone gets the url is different.

I ran some tests and noticed something else, on a page that accepts an id value (http://site.com/download/145) where 145 is an id for a file, if you go to that link in a phone browser it works fine and you download the file. If you send it in an sms the server errors out saying that the id is expected to be a float and it received a string. So why is it that when the phone links directly from sms the url parameters are strings but when used in a browser the actually get parsed as a float?

Sorry for the long winded explanation but it's a strange issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文