PHP + SWFUpload - cookie 设置问题

发布于 2024-09-28 15:09:14 字数 206 浏览 2 评论 0原文

我有一个基于 SWFUpload 的上传系统,它调用 PHP 脚本。 问题是,如果上传的文件出现任何问题(图像尺寸太小、mp3 文件太短等),系统应该通过设置带有错误消息的 cookie 来抛出错误(这是整个 CMS 处理的方式)错误)。问题是由 SWFUpload 调用的脚本设置的 cookie 在浏览器中似乎不可见...

有没有解决方案,或者我是否必须通过数据库传递错误消息?

I have an upload system based on SWFUpload which calls PHP script.
The problem is that in case of any problem with the uploaded file (too small image dimmensions, too short mp3 file etc) the system is supposed to throw an error, by setting the cookie with error message (this is the way the whole CMS handles errors). The problem is that cookie set by script which is called by SWFUpload doesn't seem to be visible back in browser ...

Is there any solution for that, or do I have to pass the error messages through the database?

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

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

发布评论

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

评论(1

你与昨日 2024-10-05 15:09:14

每当有人遇到 Flash 和 Cookie 问题时,我都会立即想到这个长期运行的 flash bug< /a>.

您应该能够通过打印出服务器端的会话 ID(当您收到上传请求时)并将其与浏览器中的会话 ID 进行比较(使用 firebug 或等效工具)来验证是否是这个。如果不同,我认为可以肯定地说这是这个错误的错。

解决这个问题的常用方法是将 GET 变量和会话附加到上传 URL,然后手动将其设置为服务器端的会话。

这里关于这个问题的另一个SO线程有一个很好的答案(不幸的是不是特定于php,但可能会给你一个好主意)。

另外,我在谷歌上看到了大量的php解决方案(flash + upload + cookie),但还没有专门在 php 中解决这个问题,所以我不能推荐一个源而不是其他源。

如果您有时间,请注册 adobe 的 bug 跟踪器,以便对 bug 进行投票,以便我们可以让 Adob​​e 清楚地知道它正在影响很多人。

希望这些细节足以让您有一个良好的开端。

Whenever anyone runs into problems with flash and cookies, I immediately think of this long running flash bug.

You should be able to verify whether it is this one by printing out the session id server-side (when you receive the upload request) and comparing it against the session id in the browser (using firebug or equivalent). If it is different, I think it is safe to say it is this bug's fault.

The usual way to work around it is to append a GET variable with the session to the upload url, then take that and manually set it to be the session on the server-side.

Here's another SO thread about this problem that has a good answer (unfortunately not specific to php, but might give you a good idea).

Also, I have seen a fair amount of php solutions on google (flash + upload + cookie), but haven't solved this problem in php specifically so I can't recommend one source over any other.

If you have the time please sign up to adobe's bug tracker just to vote up the bug so we can make it really clear to Adobe that it is affecting a lot of people.

Hopefully that's enough detail to get you off to a good start.

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