## The image file you tried to attach is invalid

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### The image file you tried to attach is invalid

I installed phpBB 3.3 fresh just a few days ago on my own WIN server 2008. Now I encounter this problem. I try to add a PNG file, 106 KB size and get this message "The image file you tried to attach is invalid".

I tried JPG, same thing. I tried larger files. Same thing.

In ACP>Posting>Attachement Settings> Max File Size = 256 KB. I increased Max File Size to 512 KB. Same thing.

There is an old post that tells me to set "php_value upload_max_filesize 4M in .htaccess but that variable is not there in my .htaccess file. I am afraid to add it.
Another old post tells me to add the same to public_html\PHP.ini, but I do not have a file called PHP.ini
Another old post tells me to add the folder "/tmp" like in /public/sites/www.mysite.com/tmp but I do not have /public

What can I do?

Mick
Support Team Member
Posts: 22325
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

### Re: The image file you tried to attach is invalid

There’s nothing to worry about, the PHP settings are server side nothing to do with phpBB as such and I would assume they’re already set but just set too low. Your host will be able to increase upload_max_filesize and post_max_size for you. You can see what’s set now in ACP> PHP information.

Edit: Sorry, I skipped the bit where you said you were self hosted, if you don’t know how to change the settings the information is on https://www.php.net/

BTW: /public would be your domain root, all installations aren’t the same, some use /public_html.
"The more connected we get the more alone we become" - Kyle Broflovski

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid

I checked PHP information. I have upload_max_filesize=2M and post_max_size=8M. I can't upload even 106K. The problem is not the size. I tried PNG and JPG. No luck. Something else is wrong. What can I do?

3Di
Former Team Member
Posts: 15042
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

### Re: The image file you tried to attach is invalid

Do you have this settings in acp/posting/manage attachements estensions ?

2020-03-25 23_16_44-Manage attachment extensions.png (11.57 KiB) Viewed 258 times
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid

Yes, I have exactly that.
Maybe it's a permissions issue at the folder at the server where the images are supposed to be stored. How can I check? What is the location of the folder?
In topic viewtopic.php?t=1256465 (locked) I found this statement "I made sure the extension group was given the permissions it needed." What is "the extension group" and How can I make sure it has the permissions it needs?

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid

I found this in an old post:
stevemaury wrote:
Sun Nov 18, 2018 4:13 pm
Is the permission on the /files folder 777?
So I went to check it. 777 is for Linux. My server is WinServer2008R2.
My .htaccess in /files is like this:

Code: Select all

<Files *>
Order Allow,Deny
Deny from All
</Files>

That is not right, is it? It is denying "all".
And in Windows, actually IIS, one needs to use a Win.Config, isn't it?
It is my own server but I don't so much. The site I created to hold phpBB is under IIS.
What should I do to solve this problem "The image file you tried to attach is invalid"

Inside /file, besides .htaccess, there is no other file, which I guess means that the images are not stored there. Somehow IIS or phpBB or Windows is denying access to store the figures, I guess.

Mick
Support Team Member
Posts: 22325
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

### Re: The image file you tried to attach is invalid

Yes IIS doesn’t use .htaccess it uses web.config.
"The more connected we get the more alone we become" - Kyle Broflovski

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid

Since I don't know how to write a web.config file, I tried this:
On the server > File Explorer, right click on /files > Properties > Sharing > Advanced Sharing > check Share this folder > Permissions > Allow > Full control > OK > OK > Close.
Then on IIS > Sites > my_site > restart.
And just in case IIS > application pool > my_site > stop, wait a few seconds > start.
It did not work. Still get the same message "The image file you tried to attach is invalid."

How do I write a web.config to replicate the 777 setting?

Mick
Support Team Member
Posts: 22325
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

### Re: The image file you tried to attach is invalid

Server setup is beyond the scope of these forums, while we can try to help you you would be better off visiting a site dedicated to your server type. Do you need to use IIS, can’t you use Linux? Having said that there’s a closed ticket in the tracker, it’s a bit ancient (2010) but it may give you an idea and there is other information via search.
"The more connected we get the more alone we become" - Kyle Broflovski

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid

OK,
Server setup is beyond the scope of these forums

but I still need your help to make it work on Win Server, that's all I got.

I just tried to upload my avatar, it did not work, but the message is more clear now
Temporary folder could not be found or is not writable.
Could you tell me where is the "temporary folder" and how is named? tmp?, or temp? -- maybe I have to add it?

Here is what I have in the root (fresh install)--no temp, tmp, etc....--

Directory of D:\BB
03/27/2020 09:34 AM <DIR> .
03/27/2020 09:34 AM <DIR> ..
01/06/2020 11:21 AM 2,734 .htaccess
01/06/2020 11:21 AM 952 app.php
03/21/2020 02:18 PM <DIR> assets
03/27/2020 09:34 AM 0 bb.txt
03/21/2020 02:18 PM <DIR> bin
03/21/2020 03:29 PM <DIR> cache
01/06/2020 11:21 AM 5,535 common.php
01/06/2020 11:21 AM 1,978 composer.json
01/06/2020 11:21 AM 157,451 composer.lock
03/21/2020 02:18 PM <DIR> config
03/21/2020 03:29 PM 460 config.php
01/06/2020 11:21 AM 1,022 cron.php
03/21/2020 02:18 PM <DIR> docs
03/26/2020 10:02 AM <DIR> ext
01/06/2020 11:21 AM 944 faq.php
01/06/2020 11:21 AM 1,667 feed.php
03/27/2020 09:21 AM <DIR> files
03/21/2020 02:18 PM <DIR> images
03/21/2020 02:18 PM <DIR> includes
01/06/2020 11:21 AM 8,470 index.php
03/21/2020 02:18 PM <DIR> language
01/06/2020 11:21 AM 9,326 mcp.php
01/06/2020 11:21 AM 61,960 memberlist.php
03/21/2020 02:18 PM <DIR> phpbb
01/06/2020 11:21 AM 76,556 posting.php
01/06/2020 11:21 AM 1,104 report.php
01/06/2020 11:21 AM 57,088 search.php
03/21/2020 03:29 PM <DIR> store
03/21/2020 02:18 PM <DIR> styles
01/06/2020 11:21 AM 11,992 ucp.php
03/21/2020 02:18 PM <DIR> vendor
01/06/2020 11:21 AM 41,068 viewforum.php
01/06/2020 11:21 AM 17,118 viewonline.php
01/06/2020 11:21 AM 93,238 viewtopic.php
03/21/2020 02:30 PM 1,309 web.config

Mick
Support Team Member
Posts: 22325
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

### Re: The image file you tried to attach is invalid

That would be a temporary folder in the root directory of the server and I think it’s called /tmp (you probably need to check that) and has to be writeable. If it’s not there and it’s required then yes you’ll have to create it.
"The more connected we get the more alone we become" - Kyle Broflovski

ejbarbero
Registered User
Posts: 21
Joined: Sat Mar 21, 2020 2:03 pm
Location: Morgantown, WV
Name: Ever Barbero
Contact:

### Re: The image file you tried to attach is invalid, Windows Server

Finally, I found the SOLUTION:
Create a folder named \tmp somewhere, such as in the root, say C:\, or like I did, in the folder where my forum installations is, whatever.
Do not need to make this folder write-able. Just create the folder.
Go to the folder where you have PHP installed (not phpBB, PHP itself) in my case \php-7.4.4-Win32-vc15-x64 and edit this file:

Code: Select all

\phi.ini
In php.ini, find this:

Code: Select all

;sys_temp_dir =""
and change it to this:

Code: Select all

sys_temp_dir = "complete path to your \tmp file"
Save it.
Then on IIS > Sites > your site > restart.
Done! Solved!