PHP 和 SwfUpload
我正在尝试在我的网页中实现 SwfUpload ,并且我正在使用 php 将文件保存在服务器上。由于这是我第一次使用此组件,我选择运行 SwfUpload 团队建议的算法 (http ://swfupload.org/forum/generaldiscussion/214):我已将其放入文件中,并且已说过将其用作代码文件的控件。
它不起作用,因为我正在寻求帮助,但真正让我发疯的是我真的不知道如何调试那些东西!对文件的请求被封装到 flash 对象中,如果出现问题我无法从中获得任何反馈。
有人比我对这个控制更有经验吗?
谢谢
I'm trying to implement SwfUpload in my web page, and I'm using php to save files on server. As is the first time I use this component, I choose to run the algoritm is suggested from the SwfUpload team (http://swfupload.org/forum/generaldiscussion/214): I've put it in a file and I've said the control to use it as code file.
It didn't work, as I'm asking help, but what really drives me crazy is that i really don't know how to debug that stuff! The request to the file is encapsulated into the flash object, and i can't get any feedback from it if something goes wrong.
Anyone is more experienced than me about this control?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果其他方法都失败,您可以做的一件事就是将 upload.php 附加到日志文件中您的调试消息。示例:
file_put_contents("swfupload.log", print_r($_REQUEST, 1), FILE_APPEND);
您需要了解的有关 swfupload 的唯一棘手的事情是,flash 组件以不同的方式运行cookie jar(出于安全原因),因此您需要手动告诉它(通过 flash 参数)您当前在服务器上拥有的 session_id,因此当它向
upload.php
发出 http 请求时,它会通过$_GET
参数中的 session_id 和 PHP 脚本使用该特定 id 启动会话:session_start($_GET['SESSION_ID']);
。从那时起,upload.php
的行为就像任何其他具有可用会话数据的 php 代码一样。你得到$_FILES
,将它们移动到各自的文件夹,将它们保存在数据库中,就是这样。One thing you can do if all else fails is to make upload.php append to a log file your debug messages. Example:
file_put_contents("swfupload.log", print_r($_REQUEST, 1), FILE_APPEND);
The only tricky thing about swfupload that you need to understand, is that the flash component is run with a different cookie jar (for security reasons), so you need to manually tell it (via a flash param) the session_id you currently have on the server, so when it makes the http request to
upload.php
it passes that session_id in a$_GET
param and the php script starts the session with that specific id:session_start($_GET['SESSION_ID']);
. From that point on,upload.php
behaves just like any other php code with your session data available. You get the$_FILES
, move them to their respective folder, save them in db, and that's it.那么 SWFUpload 需要将文件上传到某个脚本,因此您可以根据收到的数据从该脚本内登录到文件......
Well SWFUpload needs to upload the file to some script, so you can log to a file from within that script based on data received...
哦,调试起来很痛苦。
获取脚本输出(可能是一些您无法记录的致命错误或其他错误)的一种方法是使用像 fiddler 显示所有 http 流量。
有时很难使用代理获取 Flash。即使您使用其他浏览器,也可能需要在 IE 中配置代理。
Oh, that's a pain to debug.
One way to get to the script output (which might be some fatal errors that you can't log or something) is to use a proxy like fiddler that shows you all http traffic.
It's sometimes hard to get flash using the proxy. You may need to configure the proxy in IE even if you use another browser.