Workaround for attachment/image upload failing on IIS #1498

Closed
opened 2026-02-05 01:03:53 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @sjoerdvanderhoorn on GitHub (Jan 18, 2020).

Describe the bug
Uploading a file attachment or inline image fails on my IIS 7.5 site. When inspecting the network traffic using the browser's developer tools, all requests fail specifically with a HTTP500 error.

Workaround

  • Edit file \app\Uploads\AttachmentService.php
  • Find line $attachmentData = file_get_contents($uploadedFile->getRealPath()); and replace with $attachmentData = file_get_contents($uploadedFile->getPathname());
  • Edit file \app\Uploads\ImageService.php
  • Find line $imageData = file_get_contents($uploadedFile->getRealPath()); and replace with $imageData = file_get_contents($uploadedFile->getPathname());

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v0.27.5
  • PHP Version: 7.4.1
  • Hosting Method (Nginx/Apache/Docker): IIS
Originally created by @sjoerdvanderhoorn on GitHub (Jan 18, 2020). **Describe the bug** Uploading a file attachment or inline image fails on my IIS 7.5 site. When inspecting the network traffic using the browser's developer tools, all requests fail specifically with a HTTP500 error. **Workaround** * Edit file `\app\Uploads\AttachmentService.php` * Find line `$attachmentData = file_get_contents($uploadedFile->getRealPath());` and replace with `$attachmentData = file_get_contents($uploadedFile->getPathname());` * Edit file `\app\Uploads\ImageService.php` * Find line `$imageData = file_get_contents($uploadedFile->getRealPath());` and replace with `$imageData = file_get_contents($uploadedFile->getPathname());` **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v0.27.5 - PHP Version: 7.4.1 - Hosting Method (Nginx/Apache/Docker): IIS
Author
Owner

@ssddanbrown commented on GitHub (Dec 17, 2020):

Thanks for reporting @sjoerdvanderhoorn.

As far as I can tell, IIS 7.5 is fairly end-of-life and out of support at this point. I also have not heard of this issue from other IIS users. For those reasons I'm going to close this off but if the same is observed in more recent versions of IIS please feel free to open a new issue referencing this one.

@ssddanbrown commented on GitHub (Dec 17, 2020): Thanks for reporting @sjoerdvanderhoorn. As far as I can tell, IIS 7.5 is fairly end-of-life and out of support at this point. I also have not heard of this issue from other IIS users. For those reasons I'm going to close this off but if the same is observed in more recent versions of IIS please feel free to open a new issue referencing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1498