0

誰かがIIS7のPHPFastCGIのExtJS4で必要な構成(またはトラブルシューティング)ファイルのアップロードを手伝ってくれますか?アプリケーションのユーザーインターフェイスは正常に機能していますが、ファイルが\file_upload\public\tmp\uploadフォルダーに移動していません。

より詳しく:

過去数日間、ExtJS 4用のさまざまなマルチファイルアップロードウィジェットを試してきました。一部は新しいHTML5ファイルAPIでのみ機能しますが、InternetExplorerでは機能しません。また、ExtJS 4とうまく調和しないユーザーインターフェイスを備えているものもあるので、少し間抜けに見えると思いました。非常にシンプルですが、ようやくすべてのブラウザで動作するものを見つけました。PHPFastCGIを使用するIIS7上のWindowsServer2008で、以下のExtJS / PHP複数ファイルアップロードアプリケーション(ブログリンク)を構成しました。セットアップについていくつか説明があります。アプリケーションのユーザーインターフェイスを機能させるための構成とその他のいくつかのことを除いて、アプリケーションでは実際には何も変更していません。

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.)\file_upload\public\tmp\uploadPHPファイルのファイルアップロードフォルダを作成して、そのファイルを配置します

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

6.)IIS7のWindowsServer 2008(x64)でPHPをセットアップする

  • WindowsServer2008のIIS7で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.)IIS 7に明らかに問題があるため、phpファイルの先頭に配置しました。

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

8.)ここで回答に従って、IIS 7forPHPでHTTPエラーを構成します。

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

  • IISマネージャー>Webサイトをクリック>構成エディター>system.webServer>httpErrors>「DetailedLocalOnly」を「Detailed」に変更

9.)C:\Windows\php.iniこの構成設定を「オン」に設定しました

display_errors = On

または、IIS 7でFastCGIを使用しているので、この構成設定を「stderr」に設定する必要がありますか?

; 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ユーザー)

  • IISAPPPOOL{アプリケーションプール}

11.)\file_uploadファイルをIISサイトのWebルートフォルダーとして使用します

4

1 に答える 1

0

これを修正するためにいくつかのことをしなければなりませんでした:

デフォルトの「upload.php」ファイルは、各ファイルに対して毎回成功する偽のJSON応答を提供しているだけであることに気付きました。そこで、「upload.php」のバックアップを作成し、「upload_old.php」と呼びました。次に、「upload_into_dir.php」に名前を付けて保存し、ExtJSコードが7つの異なる場所で「upload.php」を参照しているため、名前を「upload.php」に変更しました(一部の場所は単なるドキュメントです)。

次に、ファイルをアップロードしようとすると、次のエラーが発生しました。

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"}

私は「。」を入れなければなりませんでした。私のファイルを認識するためのWindowsforPHPのパスの前。その後、それはうまくいきました。

define('UPLOAD_DIR', './tmp/upload/');
于 2013-03-15T22:46:48.663 に答える