好的,我在用测试文件上传时,从Internet Explorer收到了这个奇怪的意外响应
smarty
在里面
php
。
这是我上传文件的智能代码(
view
),简化为主要问题,对于那些没有使用activecollab的人
Router::assemble
只是用从MVC中读取的参数形成一个url。
(来源:
iforce.co.nz
)
<div id="xero_invoice_manager_api">
{form action=Router::assemble('xero_invoice_manager_api') method=post id="xero_invoice_manager" enctype="multipart/form-data"}
<div class="content_stack_wrapper">
<input type="file" name="file_1" /><br/>
<input type="file" name="file_2" /><br/>
{wrap_buttons}
{submit success_event="api_updated" }Authenticate{/submit}
{/wrap_buttons}
{/form}
</div></div>
这是我对
看法
。
App.Wireframe.Events.bind('api_event_finished.content', function(event, settings) {
App.Wireframe.Flash.success(App.lang('Xero Invoice Manager has saved/uploaded your Xero API data.'));
});
这是我的简化控制器(我发现问题出在smarty上,而不是php上)。
//api view
function api(){
if ( $this->request->isSubmitted()) {
$this->response->respondWithData(true);
}
}
这是我的控制器,正在进行上传。。
//api view
function api(){
$this->assignSmarty();
if ($this->request->isSubmitted()) {
$this->XeroAuthUpdate(); //update everything
if(isset($_FILES)){
$file_manager = new XeroFileManager();
$file_manager->dumpFiles($_FILES);
//upload the files
foreach($_FILES as $file){
$file_manager->handle_certificate_file($file);
} //foreach add the headers
if(function_exists('headers_list')){
xeroDebugMode("[Controller] the headers to be sent are... ", headers_list());
} //function check
} //end if
$this->response->respondWithData(array(
// constraints
'key_result' => (bool)$this->checkValue(XeroAuths::getSetting('xero_consumer')),
'secret_result' => (bool)$this->checkValue(XeroAuths::getSetting('xero_secret')),
// files secruity certificates
'publickey' => (bool)file_exists(XERO_PUBLIC_KEY_PATH),
'privatekey' => (bool)file_exists(XERO_PRIVATE_KEY_PATH),
'xero_auth' => (bool)validateXeroAuth(),
//login constraints
'install' => !$this->checkInstallRequirements(),
));
} //close the request
}
以下是firefox对
file_1
和
file_2
不是空的。
(来源:
iforce.co.nz
)
以下是来自internet explorer 9的回复
文件_1
和
文件_2
空的
(到目前为止还不错)。
(来源:
iforce.co.nz
)
这是
有问题的
来自internet explorer 9的响应
文件_1
(即公钥.cer)和
文件_2
(即私钥.pem)
不为空
(下载index.php?)。
(来源:
iforce.co.nz
)
我来自activecollab的回复
你好,米歇尔,
很抱歉回复太晚了。
不幸的是,我们无法弄清楚问题出在哪里。看起来一切都写得很好,但如果不处理代码本身,我们几乎无能为力。在IE中处理JSON响应在整个activeCollab中都很好(好吧,在IE6中不是这样),因为aC 3中的几乎所有内容都基于JSON,这使得您的问题变得特定,并且您的代码中可能有问题。
当做
奥利弗·马克西莫维奇
activeCollab开发&支持
一般和售前问题:1-888-422-6260(免费)技术支持:support@activecollab.com
一位同事建议。。
不过,建议尝试以下操作:
1) 打开IE->打开显影剂工具(按F12)->单击菜单中的“缓存”->单击“清除浏览器缓存”。。。完成后,单击“缓存”,然后单击“始终从服务器刷新”。
这迫使IE不缓存任何内容,因为我已经多次看到IE缓存ajax请求并导致一些非常奇怪的行为。
让我看看这是否解决了您的问题,如果是的话,我们可以在您的ajax响应中添加一些php,以强制所有浏览器从不缓存响应。否则,如果这仍然不起作用,可能需要在IE中进行一些JS调试,看看发送了什么,并将其与您的FF firebug结果进行比较。
headers_sent()
出现空白
但是
headers_list
(就在之前
respondWithData
称为),用于Internet Explorer。
2012-08-08 06:50:16 the headers sent from this request is... Array
(
[0] => X-Powered-By: PHP/5.3.8
[1] => Set-Cookie: ac_activeCollab_sid_yhRk0xSZku=1%2Fhkykz0Rw0796e4lDykXekNXvhMMxC8pV4akJPMvA%2F2012-08-08+06%3A50%3A15; expires=Wed, 22-Aug-2012 06:50:15 GMT; path=/
[2] => Content-Type: application/json
[3] => Expires: Mon, 26 Jul 1997 05:00:00 GMT
[4] => Cache-Control: no-cache, no-store, must-revalidate
[5] => Pragma: no-cache
)
来自的响应标头
Raw
选项卡上的Fiddler,在Internet Explorer上
HTTP/1.1 200 OK
Date: Sat, 11 Aug 2012 08:08:46 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: ac_activeCollab_sid_yhRk0xSZku=11%2Fz8rWxiRchAh8EWinYO2d7a1mmvn2DMKUdse1vfKh%2F2012-08-11+0 8%3A08%3A46; expires=Sat, 25-Aug-2012 08:08:46 GMT; path=/
Content-Length: 107
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
{"key_result":true,"secret_result":true,"publickey":true,"privatekey":true,"xero_auth":true,"install":true}
来自的响应标头
未经加工的
选项卡。
HTTP/1.1 200 OK
Date: Sat, 11 Aug 2012 08:13:45 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: ac_activeCollab_sid_yhRk0xSZku=12%2FO40CbXC9Vfa7OVnderlK2MFnvnpkyeckvO0Ab5NQ%2F2012-08-11+08%3A13%3A45; expires=Sat, 25-Aug-2012 08:13:45 GMT; path=/
Content-Length: 107
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
{"key_result":true,"secret_result":true,"publickey":true,"privatekey":true,"xero_auth":true,"install":true}
你知道我在IE上做错了什么吗?以及Internet Explorer通知用户下载的原因
index.php
(当字段与值一起处于活动状态时)。请记住,服务器端没有实际上传(在初始测试期间,index.php下载请求与
move_uploaded_file
)。