ExtJS 4和PHP多文件上传小部件配置错误时,安装在Windows Server 2008使用IIS 7和FastC


ExtJS 4 and PHP multiple file upload widget configuration incorrect when installed on Windows Server 2008 using IIS 7 and FastCGI PHP

有人可以帮助我必要的配置(或帮助排除故障)文件上传与ExtJS 4在PHP FastCGI在IIS 7?应用程序用户界面工作正常,但是文件没有移动到'file_upload'public'tmp'upload文件夹。

更多细节:

在过去的几天里,我一直在尝试ExtJS 4的不同多文件上传小部件。有些只适用于新的HTML 5文件API,但在Internet Explorer中无法使用。有些只是有一个用户界面,不能很好地与ExtJS 4配合,所以我认为他们会看起来有点傻。我终于找到了一个适用于所有浏览器的,尽管它很简单!我已经配置了ExtJS/PHP多文件上传应用程序下面(博客链接)在Windows Server 2008 IIS 7与PHP FastCGI。我有一些关于安装的说明。除了配置和一些其他的东西,我并没有真正改变应用程序的任何东西,以使应用程序的用户界面工作。

Windows设置说明:

1。)

http://blog.debug.cz/2012/05/file-upload-widget-for-extjs-4x.html

示例如下:

http://debug.cz/demo/upload/

在GitHub上下载源代码:

https://github.com/ivan-novakov/extjs-upload-widget

2。)将提取的文件放在桌面上,为了简单起见,将根文件夹重命名为"file_upload"

3)。下载ExtJS 4并将ExtJS 4根文件夹重命名为"ExtJS",并放置在此文件夹中:

'file_upload'public'[extjs]

下载并解压:

http://cdn.sencha.io/ext-4.1.0-gpl.zip

4. (Windows)将"upload"快捷文件重命名为"upload_old"(或直接删除),并将实际上传文件夹'file_upload'lib'upload复制到文件夹'file_upload'public'external'upload

5)。为PHP文件创建文件上传文件夹'file_upload'public'tmp'upload,以放置其文件

define('UPLOAD_DIR', '/tmp/upload/');

6)。在IIS 7中设置PHP

  • 在Windows Server 2008上打开IIS 7的CGI

  • 已下载IIS 7.0 (x64)管理包

http://www.howtogeek.com/50432/how-to-install-php-on-iis-7-for-windows-server-2008/

使用以下php.ini设置:

cgi.force_redirect = 0
fastcgi.impersonate = 1
extension_dir = "D:'Program Files'php'ext"
date.timezone = "America/Chicago"
extension=php_curl.dll"
display_errors = On ==========> more notes below
upload_tmp_dir = "{desktop path}'file_upload'public'tmp'upload"

7。)放置在我的php文件的顶部,因为显然有一些问题与IIS 7??

<?PHP
ini_set('display_errors',true);

8。)以下是在IIS 7中配置HTTP错误的答案

https://serverfault.com/questions/19561/how-can-i-display-and-log-php-errors-on-iis7

  • IIS管理器>单击网站>配置编辑器>系统。webServer> httperors>将"DetailedLocalOnly"更改为"Detailed"

9。)在C:'Windows'php.ini中,我将此配置设置为"On"

display_errors = On

或者应该将此配置设置设置为"stderr",因为我在IIS 7中使用FastCGI ?

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = On
10.)修改'file_upload文件夹及其子文件夹 的安全性
  • IIS_IUSRS用户组(或仅IUSR用户)

  • IIS appool{应用程序池}

11)。使用'file_upload文件作为IIS站点的web根文件夹

必须做一些事情来解决这个问题:

我意识到默认的"upload.php"文件只是给了一个假的JSON响应,每次都成功的每个文件。所以我备份了"upload.php",并命名为"upload_old.php"。然后我做了一个保存为"upload_into_dir.php",并更名为"upload.php",因为ExtJS代码引用"upload.php"在7个不同的地方(有些地方只是文档虽然)。

然后当我试图上传我的文件时,我得到了这个错误:

Ext.Error: You're trying to decode an invalid JSON String: <br />
<b>Warning</b>:  fopen(/tmp/upload/test.jpg): failed to open stream: No such file or directory in <b>C:'Users'macgyver'Desktop'file_upload'public'upload.php</b> on line <b>28</b><br />
{"success":false,"message":"Error writing to file"}

我必须在Windows的路径前面放一个"。",以便PHP识别我的文件。

define('UPLOAD_DIR', './tmp/upload/');