Error on file attachment #3811

Closed
opened 2026-02-05 07:32:48 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @scotty85 on GitHub (May 22, 2023).

Describe the Bug

I'm working on BookStack v23.05.1. Upgraded to this version to solve attachment issues.
In this version when uploading attachment file get small error banner {"uploaded_to": ["field uploaded to is required"]}, and no file is sent to server.
att

Steps to Reproduce

  1. Open created page
  2. Open edit mode for page
  3. Open attachment side panel
  4. Click buton Add File
  5. select simple text file from local resources
  6. Clicking open buton
  7. Get baner with file name and error

Expected Behaviour

Successfully upload attachment file to page.

Screenshots or Additional Context

I have set STORAGE_ATTACHMENT_TYPE=local in .env file
Attachment in previous version didn't work either

Browser Details

No response

Exact BookStack Version

23.05.1

PHP Version

8.2

Hosting Environment

Debian 11

Originally created by @scotty85 on GitHub (May 22, 2023). ### Describe the Bug I'm working on BookStack v23.05.1. Upgraded to this version to solve attachment issues. In this version when uploading attachment file get small error banner {"uploaded_to": ["field uploaded to is required"]}, and no file is sent to server. ![att](https://github.com/BookStackApp/BookStack/assets/11891777/95cc8a80-3f67-4873-9070-6e33e6df1f64) ### Steps to Reproduce 1. Open created page 2. Open edit mode for page 3. Open attachment side panel 4. Click buton Add File 5. select simple text file from local resources 6. Clicking open buton 7. Get baner with file name and error ### Expected Behaviour Successfully upload attachment file to page. ### Screenshots or Additional Context I have set STORAGE_ATTACHMENT_TYPE=local in .env file Attachment in previous version didn't work either ### Browser Details _No response_ ### Exact BookStack Version 23.05.1 ### PHP Version 8.2 ### Hosting Environment Debian 11
OVERLORD added the 🐛 Bug label 2026-02-05 07:32:48 +03:00
Author
Owner

@ssddanbrown commented on GitHub (May 22, 2023):

Hi @scotty85,
Just to confirm:

  • Have attachments ever worked for you on your instance on any version?
  • Do attachments work for you when using our demo instance?
  • How have you installed BookStack and what web-server do you use?
@ssddanbrown commented on GitHub (May 22, 2023): Hi @scotty85, Just to confirm: - Have attachments ever worked for you on your instance on any version? - Do attachments work for you when using [our demo instance](https://demo.bookstackapp.com/books/bookstack-demo-site/page/logging-in-to-the-demo-site)? - How have you installed BookStack and what web-server do you use?
Author
Owner

@scotty85 commented on GitHub (May 22, 2023):

Thank you for quick response

  • yes, attachments never worked on my instance before update
  • yes, attachments work on demo
  • I installed from git repository, and configured manually to use nginx web server
@scotty85 commented on GitHub (May 22, 2023): Thank you for quick response - yes, attachments never worked on my instance before update - yes, attachments work on demo - I installed from git repository, and configured manually to use nginx web server
Author
Owner

@ssddanbrown commented on GitHub (May 22, 2023):

@scotty85 Thanks for the info, can you please provide your nginx config for BookStack?

@ssddanbrown commented on GitHub (May 22, 2023): @scotty85 Thanks for the info, can you please provide your nginx config for BookStack?
Author
Owner

@scotty85 commented on GitHub (May 22, 2023):

Here is my nginx config file:

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	
	root /var/www/BookStack/public;
	
	index index.html index.php;

	server_name 172.23.0.23;

	location / {
		try_files $uri $uri/ /index.php?query_string;
	}

	location ~\.php$ {
		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/run/php/php8.2-fpm.sock;
	}
}
@scotty85 commented on GitHub (May 22, 2023): Here is my nginx config file: ```nginx server { listen 80 default_server; listen [::]:80 default_server; root /var/www/BookStack/public; index index.html index.php; server_name 172.23.0.23; location / { try_files $uri $uri/ /index.php?query_string; } location ~\.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.2-fpm.sock; } } ```
Author
Owner

@ssddanbrown commented on GitHub (May 22, 2023):

Thanks @scotty85.

I think you're missing a dollar sign on one of your lines:

# This line:
try_files $uri $uri/ /index.php?query_string;

# Should probably be this:
try_files $uri $uri/ /index.php?$query_string;

Remember to restart nginx after updating your config.

@ssddanbrown commented on GitHub (May 22, 2023): Thanks @scotty85. I think you're missing a dollar sign on one of your lines: ```nginx # This line: try_files $uri $uri/ /index.php?query_string; # Should probably be this: try_files $uri $uri/ /index.php?$query_string; ``` Remember to restart nginx after updating your config.
Author
Owner

@scotty85 commented on GitHub (May 22, 2023):

Yes, that solve the problem. Thank you.
Must missed sigh during configuration.

@scotty85 commented on GitHub (May 22, 2023): Yes, that solve the problem. Thank you. Must missed sigh during configuration.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3811