[SOLVED] 404 error when attaching file to issue

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
balicohe
Posts: 3
Joined: 10 Jul 2015, 11:16

[SOLVED] 404 error when attaching file to issue

Post by balicohe »

When I try to attach a file to an issue I always get the error message
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
This also happens when I create an new issue where I would like to attach the file within the same step.

I already checked the limits in php.ini and in config_inc.php which should not cause the error:

Code: Select all

$g_allow_file_upload	= ON;
$g_file_upload_method	= DATABASE;
$g_absolute_path_default_upload_folder = '';
$g_max_file_size		= 5000000;
$g_preview_attachments_inline_max_size = 256 * 1024;
$upload_tmp_dir = 'C:/temp/';
Is there anything I need to further check such as special permissions on the server for upload directories etc.? All the folders that PHP and Mantis use do have write permissions for the user "IUSR". Does anybody have a clue?

My Mantis configuration:
  • OS: Windows Server 2008 R2 Standard
  • MantisBT Version: 1.2.19
  • Schema Version: 183
  • PHP Version: 5.6.0
--
Similar forum requests: Edit 27.07.2015: issue solved
Last edited by balicohe on 27 Jul 2015, 10:38, edited 1 time in total.
MantisBT Version: 1.2.19
PHP Version: 5.6.0
SQL: 5.6.19 MySQL Community Server
OS: Windows Server 2008 R2 Standard
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Re: 404 error when attaching file to issue

Post by newmantisuser »

I think I read in the Manual that you can change file upload method from DATABASE to file system or something like that. Give that a try? Also try turning on all the permissions just to rule out the possibility of it being an filesystem ACL issue, and make sure your using the most up to date version of whatever browser (Firefox is what I would recommend)

Shoulden't it be c:\temp instead of c:/temp if your on windows....


Here is my file upload section of my configuration file just for reference


# File Upload and Attachment Options
# You may also have to configure your php.ini file to
# increase the execution time, memory limit, max post size, and max upload size.
# The PHP value is usually defaulted to 2MB.
# If $g_allowed_files is filled in NO other file types will be allowed
$g_file_upload_max_num = 5;
# $g_max_file_size = 9000000; # 9MB
$g_max_file_size = 1000000000; # 100MB

$g_allowed_files = "zip,png,bmp,gif,jpg,tiff,jpeg,txt,pdf,doc,docx,xls,xlsx,ppt,pptx,odt,fodt,ods,fods,odp,fodp,odb,odg,fodg,odf,tcl,dat,mp4,avi,wmv,mpg,mpeg,mp3"
balicohe
Posts: 3
Joined: 10 Jul 2015, 11:16

Re: 404 error when attaching file to issue

Post by balicohe »

Thank you for your help, newmantisuser.
  • I do use the most current browser (FF + IE).
  • "c:/temp" worked before.
I will give your recommendations (file upload method and file system ACL) a try. The strange thing is: The underlying Windows server has changed last year and we moved the mantis bug tracker onto the new machine without changing any settings (PHP + Mantis). Of course we had to reinstall PHP and MySQL including the database update. So the environment should be the same but I seem to be missing something. The tracker itself does work with the exeption of file attachments.
MantisBT Version: 1.2.19
PHP Version: 5.6.0
SQL: 5.6.19 MySQL Community Server
OS: Windows Server 2008 R2 Standard
balicohe
Posts: 3
Joined: 10 Jul 2015, 11:16

Re: 404 error when attaching file to issue - (almost) solved

Post by balicohe »

Alright, the issue is (almost) solved. :)

Unfortunately, it did not help to change the slashes to backslashes. In contrast, the issue tracker completely refrained from working so I changed them back to linux-compatible slashes. Please note that I have not tried to change the file upload method to DISK because I wanted it to work as it did before.

This is what I did:
In this special case I wanted to attach a screenshot to an issue. This screenshot is a regular PNG file (about 1.3 MB) that I had created with Paint.NET v4.0.5. I started to play with some different files that I could successfully upload now to my surprise. 8O I suspected that the error may be caused due to several blanks or a Spanish non-ASCII character within the filename. Removing all of these did not do the trick but uploading different PNG files of different sizes did work.

I finally decided to convert my PNG file to a JPG file (about 500 kB at 100% quality). Uploading this file was successful in the end!

My assumption now is that Mantis does not seem to be able to process this special PNG file. I do not have any idea why because all file size limits (PHP + Mantis) are sufficient to handle this 1.3 MB file. In addition, I do not think that Paint.NET creates somewhat invalid PNG files. So I am still unclear why this is causing a 404 error. But at the end of the day my workaround did it. :)

This took me quite a lot of hours to investigate my installations of Mantis, PHP, MySQL and the Windows server itself. I hope this thread will be useful for someone else who faces the same issue. In case someone has an idea what went wrong here I will appreciate any comment on this.
MantisBT Version: 1.2.19
PHP Version: 5.6.0
SQL: 5.6.19 MySQL Community Server
OS: Windows Server 2008 R2 Standard
Post Reply