Solved - File Upload Error - APPLICATION ERROR #15

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
phoenixcreation
Posts: 7
Joined: 20 Aug 2007, 12:51

Solved - File Upload Error - APPLICATION ERROR #15

Post by phoenixcreation »

OK, I've gone through the existing threads on this subject, and have not found a solution as of yet. I have a new install of Mantis 1.1.0a4. I can submit issues and use all the wonderful functionality of Mantis with the exception of uploading files. The error I get is:

Code: Select all

APPLICATION ERROR #15 
File upload failed. File is not readable by Mantis. Please check the project settings
This is regardless of what file type or size that I attempt to upload. The issue is created, but no attachments are processed. I desire to have the attachments saved to disk as oppossed to database, though at this point I'd be happy with any working solution as setting it to database comes up with the same error.

mySQL - 4.1.22
php - 4.4.4

Here are the settings from my config file for Upload:

Code: Select all

	###################################
	# Mantis File Upload Settings
	###################################

	# --- file upload settings --------
	# This is the master setting to disable *all* file uploading functionality
	#
	# If you want to allow file uploads, you must also make sure that they are
	#  enabled in php.  You may need to add 'file_uploads = TRUE' to your php.ini
	#
	# See also: $g_upload_project_file_threshold, $g_upload_bug_file_threshold,
	#   $g_allow_reporter_upload
	$g_allow_file_upload	= ON;

	# Upload destination: specify actual location in project settings
	# DISK, DATABASE, or FTP.
	$g_file_upload_method	= DISK;

	# When using FTP or DISK for storing uploaded files, this setting control 
	# the access permissions they will have on the web server: with the default
	# value (0400) files will be read-only, and accessible only by the user
	# running the apache process (probably "apache" in Linux and "Administrator"
	# in Windows).
	# For more details on unix style permissions:
	# http://www.perlfect.com/articles/chmod.shtml
	$g_attachments_file_permissions = 0400;

	# FTP settings, used if $g_file_upload_method = FTP
	$g_file_upload_ftp_server	= 'www..com';
	$g_file_upload_ftp_user		= '';
	$g_file_upload_ftp_pass		= '';

	# Maximum file size that can be uploaded
	# Also check your PHP settings (default is usually 2MBs)
	$g_max_file_size		= 5000000; # 5 MB

	# Files that are allowed or not allowed.  Separate items by commas.
	# eg. 'php,html,java,exe,pl'
	# if $g_allowed_files is filled in NO other file types will be allowed.
	# $g_disallowed_files takes precedence over $g_allowed_files
	$g_allowed_files		= '';
	$g_disallowed_files		= '';

	# prefix to be used for the file system names of files uploaded to projects.
	# Eg: doc-001-myprojdoc.zip
	$g_document_files_prefix = 'doc';

	# absolute path to the default upload folder.  Requires trailing / or \
	$g_absolute_path_default_upload_folder = '';
Here are my php.ini settings:

Code: Select all

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 20M
Thoughts, comments? ANY help would be greatly appreciated. Thanks in advance!
Last edited by phoenixcreation on 11 Oct 2007, 19:10, edited 2 times in total.
phoenixcreation
Posts: 7
Joined: 20 Aug 2007, 12:51

Post by phoenixcreation »

Some partial fixes. I have uploads working now. Found a thread/bug that suggested remming out the actual error messages in this regard.

http://www.mantisbt.org/bugs/view.php?id=8043

in core/file_api.php, I had to unactivate the lines:
if ( !is_readable( $p_tmp_file ) ) {
trigger_error( ERROR_UPLOAD_FAILURE, ERROR );
}
around 507, and
$t_file_size = filesize( $p_tmp_file );
if ( 0 == $t_file_size ) {
trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR );
}
around 550.
Is readable should be replaced by is_uploaded_file.
filesize should be done after the upload of a file.

Files are uploading properly at present, with correct ownership. Upload method is to DISK. But in the database they are referenced at zero size, and then cannot be downloaded (file downloads, but no data). If I set the file size manually in the database, it works fine, but I cannot do that for EVERY file that is uploaded. Does the same on DATABASE method as well.

For some reason it is not reading or at least not saving the file sizes.
phoenixcreation
Posts: 7
Joined: 20 Aug 2007, 12:51

Post by phoenixcreation »

Found some open_basedir directives that were off for filesize and is_readable for core/file_api.php. Corrected and things are now working.
gops
Posts: 1
Joined: 30 Mar 2009, 15:32

Re: Solved - File Upload Error - APPLICATION ERROR #15

Post by gops »

I was trying in windows with php 5.2.9-1 and mantis 1.1.6. Got the error when trying to upload.
I just added a security setting for IUSER_xxx with READ permission to the folder c:\windows\temp. things are working.

Now i found even if we set the upload_tmp_dir variable in the php, after a few line already a setting is there for the same variable pointing to c:\windows\temp. So if we are going to set it to another directory, comment the line for c:\windows\temp and add the IUSER_SystenName READ permission to the new directory by setting it for upload_tmp_dir if you are using just DATABASe. if using DISK, give a WRITE permission also.
windrago
Posts: 4
Joined: 07 Sep 2009, 05:48

Re: Solved - File Upload Error - APPLICATION ERROR #15

Post by windrago »

comment in which file?
I'm new to php and mantis - just in case the questions sounds too silly/obvious
Post Reply