Unable to upload image #125

Closed
opened 2026-02-04 17:04:15 +03:00 by OVERLORD · 11 comments
Owner

Originally created by @calverp on GitHub (Jun 30, 2016).

I'll begin by stating that this is very likely user error on my part. I'm running Bookstack from Windows/IIS and everything is working fine except for uploading images. If I drag a file into the upload box, a small thumbnail appears with the name and size of the file, and a red hover over box with a bunch of HTML appears, but the image doesn't save as expected.
I've checked the error log file and it is generating the attach stack trace indicating the it is missing a file name. I've confirmed the image/name is fine by uploading to your demo site fine.
Any assistance would be appreciated,
Thanks.
bookstack.txt

Originally created by @calverp on GitHub (Jun 30, 2016). I'll begin by stating that this is very likely user error on my part. I'm running Bookstack from Windows/IIS and everything is working fine except for uploading images. If I drag a file into the upload box, a small thumbnail appears with the name and size of the file, and a red hover over box with a bunch of HTML appears, but the image doesn't save as expected. I've checked the error log file and it is generating the attach stack trace indicating the it is missing a file name. I've confirmed the image/name is fine by uploading to your demo site fine. Any assistance would be appreciated, Thanks. [bookstack.txt](https://github.com/ssddanbrown/BookStack/files/341222/bookstack.txt)
OVERLORD added the 🐕 Support label 2026-02-04 17:04:15 +03:00
Author
Owner

@patoroco commented on GitHub (Feb 9, 2017):

I think that this was solved in last releases, isn't it @ssddanbrown?

@patoroco commented on GitHub (Feb 9, 2017): I think that this was solved in last releases, isn't it @ssddanbrown?
Author
Owner

@mrb2590 commented on GitHub (May 17, 2017):

I am having the same issue, I granted all users full permissions on the folder too and still getting this.

@mrb2590 commented on GitHub (May 17, 2017): I am having the same issue, I granted all users full permissions on the folder too and still getting this.
Author
Owner

@mrb2590 commented on GitHub (May 17, 2017):

From the error log:
[2017-05-17 14:05:21] production.ERROR: exception 'ErrorException' with message 'file_get_contents(): Filename cannot be empty' in C:\inetpub\wwwroot\wiki.example.com\app\Services\ImageService.php:45

@mrb2590 commented on GitHub (May 17, 2017): From the error log: [2017-05-17 14:05:21] production.ERROR: exception 'ErrorException' with message 'file_get_contents(): Filename cannot be empty' in C:\inetpub\wwwroot\wiki.example.com\app\Services\ImageService.php:45
Author
Owner

@ssddanbrown commented on GitHub (May 20, 2017):

@mrb2590 Any additional details would be great, Are you also on IIS? What version is you BookStack instance? What PHP version are you on?

@ssddanbrown commented on GitHub (May 20, 2017): @mrb2590 Any additional details would be great, Are you also on IIS? What version is you BookStack instance? What PHP version are you on?
Author
Owner

@mrb2590 commented on GitHub (May 20, 2017):

@ssddanbrown Yup I am also on IIS. I can't check right now but I believe it is the latest version of BookStack I just installed it earlier this week and installed the release version. I am using php 5.6. I was looking into it earlier and saw in the ImageService class it is calling uploadedfile->getRealPath() into file_get_contents and getRealPath is returning false. The image file is in fact in the windows temp folder and did upload successfully but I guess saving it is where it's breaking. I can get more information to you on Monday. Hope this helps! Let me know what else you may need.

@mrb2590 commented on GitHub (May 20, 2017): @ssddanbrown Yup I am also on IIS. I can't check right now but I believe it is the latest version of BookStack I just installed it earlier this week and installed the release version. I am using php 5.6. I was looking into it earlier and saw in the ImageService class it is calling uploadedfile->getRealPath() into file_get_contents and getRealPath is returning false. The image file is in fact in the windows temp folder and did upload successfully but I guess saving it is where it's breaking. I can get more information to you on Monday. Hope this helps! Let me know what else you may need.
Author
Owner

@RexSeven commented on GitHub (Jun 7, 2017):

I've had the same issue with image uploads on wordpress installs in IIS. To fix this you need to change the permissions on your temp folder. http://chris.wastedhalo.com/2011/01/wordpress-upload-permissions-on-iis-7-fix/

@RexSeven commented on GitHub (Jun 7, 2017): I've had the same issue with image uploads on wordpress installs in IIS. To fix this you need to change the permissions on your temp folder. http://chris.wastedhalo.com/2011/01/wordpress-upload-permissions-on-iis-7-fix/
Author
Owner

@mrb2590 commented on GitHub (Jun 7, 2017):

@RexSeven My hopes were up but unfortunately this did not work for me... It looks like inside app/Services/ImageService.php on line 46$imageData = file_get_contents($uploadedFile->getRealPath());is failing because getRealPath is returning false. The file is in the temp folder though. If I replace That line with this: $imageData = file_get_contents($uploadedFile->getPathName()); it does indeed work. So it's not a fix, but a workaround for now. I hate to touch the source code here to get this to work, but SplFileInfo::getRealPath() seems to be failing for some reason.

@mrb2590 commented on GitHub (Jun 7, 2017): @RexSeven My hopes were up but unfortunately this did not work for me... It looks like inside app/Services/ImageService.php on line 46` $imageData = file_get_contents($uploadedFile->getRealPath()); `is failing because getRealPath is returning false. The file is in the temp folder though. If I replace That line with this: `$imageData = file_get_contents($uploadedFile->getPathName());` it does indeed work. So it's not a fix, but a workaround for now. I hate to touch the source code here to get this to work, but SplFileInfo::getRealPath() seems to be failing for some reason.
Author
Owner

@Abijeet commented on GitHub (Jun 13, 2017):

@mrb2590 - Same happened with me and I had to touch the source code.

@Abijeet commented on GitHub (Jun 13, 2017): @mrb2590 - Same happened with me and I had to touch the source code.
Author
Owner

@Abijeet commented on GitHub (Jun 13, 2017):

Another user reported an issue here - https://bugs.php.net/bug.php?id=74411&edit=1

@Abijeet commented on GitHub (Jun 13, 2017): Another user reported an issue here - https://bugs.php.net/bug.php?id=74411&edit=1
Author
Owner

@ssddanbrown commented on GitHub (May 12, 2018):

Thank you for opening this issue. As part of an issue clean-up we're closing off older support issues that may be outdated or irrelevant so therefore I am closing this issue.

If the issue remains and it is one you are still seeking to actively solve please ensure it is still not apparent on the latest version of BookStack then open up a new issue referencing this one.

Sorry if we were not able to solve your original request.

@ssddanbrown commented on GitHub (May 12, 2018): Thank you for opening this issue. As part of an issue clean-up we're closing off older support issues that may be outdated or irrelevant so therefore I am closing this issue. If the issue remains and it is one you are still seeking to actively solve please ensure it is still not apparent on the latest version of BookStack then open up a new issue referencing this one. Sorry if we were not able to solve your original request.
Author
Owner

@LloydVillegas commented on GitHub (Mar 11, 2019):

Add permission for your IUSR in Windows temp folder

@LloydVillegas commented on GitHub (Mar 11, 2019): Add permission for your IUSR in Windows temp folder
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#125