APPLICATION ERROR #504 when uploading file

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
msanders
Posts: 9
Joined: 30 Apr 2018, 12:46

APPLICATION ERROR #504 when uploading file

Post by msanders »

Hi!

Environment: Windows Server 2012 R2, IIS 8.5.9600.16384, PHP 7.2.5, Mantis 2.14.0

Every time I try to upload a file I get the error message shown below. I'm aware of php.ini#sys_temp_dir and php.ini#upload_tmp_dir, both are NOT set, i.e. the system default (c:\windows\temp) will be used. The account IIS_IUSRS has full access to this directory.Nevertheless no upload is possible. Any idea?


APPLICATION ERROR #504

Keine Datei übertragen. Gehen Sie zurück und wählen Sie eine Datei aus, bevor Sie auf Datei übertragen drücken

Bitte benutzen Sie die „Zurück“-Taste Ihres Browsers, um auf die vorhergehende Seite zurückzukehren. Dort können Sie den hier angezeigten Eintrag korrigieren oder eine andere Aktion ausführen. Über das Menü können Sie auch direkt zu einer anderen Aktion wechseln.
Detailed error information
Full path: C:\inetpub\wwwroot\mantis\core\error_api.php
Line number: 85
Stack trace
# Filename Line Class Type Function Args
0 C:\inetpub\wwwroot\mantis\core\file_api.php 717 - - file_ensure_uploaded <array> { ['name'] => '.pgAdmin4.4076335879.log', ['type'] => '', ['tmp_name'] => '', ['error'] => 6, ['size'] => 0, ['browser_upload'] => true }
1 C:\inetpub\wwwroot\mantis\core\file_api.php 73 - - file_add <integer>45, <array> { ['name'] => '.pgAdmin4.4076335879.log', ['type'] => '', ['tmp_name'] => '', ['error'] => 6, ['size'] => 0, ['browser_upload'] => true }, <string>'bug'
2 C:\inetpub\wwwroot\mantis\core\commands\IssueAddCommand.php 339 - - file_attach_files <integer>45, <array> { [0] => <array> { ['name'] => '.pgAdmin4.4076335879.log', ['type'] => '', ['tmp_name'] => '', ['error'] => 6, ['size'] => 0 } }
3 C:\inetpub\wwwroot\mantis\core\commands\Command.php 137 IssueAddCommand -> process -
4 C:\inetpub\wwwroot\mantis\bug_report.php 246 Command -> execute -
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: APPLICATION ERROR #504 when uploading file

Post by atrol »

Do you get any errors or warnings when running admin/check/index.php ?
Please use Search before posting and read the Manual
msanders
Posts: 9
Joined: 30 Apr 2018, 12:46

Re: APPLICATION ERROR #504 when uploading file

Post by msanders »

As far as I understand nothing that matters in my case:

PHP
Database
Configuration
Detailed errors should be OFF
Setting show_detailed_errors = ON is a potential security hazard as it can expose sensitive information. WARN
Paths
core_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the core_path directory outside the web root. WARN
class_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the class_path directory outside the web root. WARN
library_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the library_path directory outside the web root. WARN
config_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the config_path directory outside the web root. WARN
language_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the language_path directory outside the web root. WARN
Directory doc does not need to exist within the MantisBT root
The doc directory within the MantisBT root should be removed as it is not needed for the live operation of MantisBT. WARN
Webservice
SOAP Extension Enabled
Enable the PHP SOAP extension. WARN
Cryptography
Internationalization
Localization
Email
Anonymous access
Attachments
Display
Some warnings were encountered. Please review and consider correcting these warnings before using MantisBT.
For security reasons, you should delete (or at least restrict access to) the admin directory. Refer to the MantisBT Admin Guide for further details.
msanders
Posts: 9
Joined: 30 Apr 2018, 12:46

Re: APPLICATION ERROR #504 when uploading file

Post by msanders »

Hi again! No hint from anybody?
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: APPLICATION ERROR #504 when uploading file

Post by cas »

ok, if you check the error message, you find a few things:
Size of the file to upload seems to be zero
C:\inetpub\wwwroot\mantis\core\file_api.php 717 - - file_ensure_uploaded <array> { ['name'] => '.pgAdmin4.4076335879.log', ['type'] => '', ['tmp_name'] => '', ['error'] => 6, ['size'] => 0, ['browser_upload'] => true }
It refers to line 717 in file_api.php to generate the error, which says:

Code: Select all

$t_file_size = filesize( $t_tmp_file );
	if( 0 == $t_file_size ) {
		trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR );
	}
Here we see that the error is triggered because the filesize =0.

My i suggest to try thi action using a file with a size >0? :mrgreen:
msanders
Posts: 9
Joined: 30 Apr 2018, 12:46

Re: APPLICATION ERROR #504 when uploading file

Post by msanders »

WTF??? The file size is definitely NOT zero but 2KB. And the file is also readable by the user I'm logged in and also not locked. I can open this plain text file using notepad. Hmm, miraculous things happen...
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: APPLICATION ERROR #504 when uploading file

Post by atrol »

I recommend to upgrade to latest stable version (2.19.0 at the moment)

This might fix your issue, if not this is a better point to start more investigations.
There are some PHP 7.2 related fixes since 2.14.0, furthermore there are some enhancements in installation checking, so running admin/check/index.php might report some new errors or warnings.

PHP 7.2.5. is also not the best one you can use.
Latest versions is 7.2.14 with a lot of fixes since 7.2.5.
Please use Search before posting and read the Manual
msanders
Posts: 9
Joined: 30 Apr 2018, 12:46

Re: APPLICATION ERROR #504 when uploading file

Post by msanders »

Ok, thanks for this. I'll do some and come back asap.
Post Reply