General discussion
Image upload isue

I am having an issue with image uploads in my forum on a shared server. When I upload an image the modal closes and then nothing is displayed in the editor.

The image file is on the server in the default directory of assets/img/attachments but the extension is stripped off.

Also an error in the console is displayed with the following:

XML Parsing Error: syntax error
Location: www.myserver.com/forum/index.php?u=/Ajax/topic/upload&tid=undefined
Line Number 1, Column 1: index.php:1:1

The network console shows a 500 error for the above URL with the following message:

"PHP Notice: Unknown: file created in the system's temporary directory in Unknown on line 0"

I would appreciate any suggestions in fixing this. My current version is V.4.8.3.226.

Thank you,

Rab

I am having an issue with image uploads in my forum on a shared server. When I upload an image the modal closes and then nothing is displayed in the editor. The image file is on the server in the default directory of assets/img/attachments but the extension is stripped off. Also an error in the console is displayed with the following: XML Parsing Error: syntax error Location: www.myserver.com/forum/index.php?u=/Ajax/topic/upload&tid=undefined Line Number 1, Column 1: index.php:1:1 The network console shows a 500 error for the above URL with the following message: "PHP Notice: Unknown: file created in the system's temporary directory in Unknown on line 0" I would appreciate any suggestions in fixing this. My current version is V.4.8.3.226. Thank you, Rab
edited Jan 16 at 11:18 pm

Hi mate I have some questions about Your problem:

  • Do You use SSL? So a URL with https:// ?
  • Does your hosting have a "tmp" folder? The tmp folder should be in your host's html folder.
  • Has the size of the image exceeded the upload limit allowed by your hoster?
  • Do your folders have the necessary folder permissions as mentioned at the CF installation documentation? (try 775 or 777)
  • Which type of image are You trying to upoad? (jpg, png, gif, ico etc.) Did you allow the right mime type in the CF backend?
  • A link to your page would be good to test it.

Kind regards, Andy

Hi mate I have some questions about Your problem: - Do You use SSL? So a URL with https:// ? - Does your hosting have a "tmp" folder? The tmp folder should be in your host's html folder. - Has the size of the image exceeded the upload limit allowed by your hoster? - Do your folders have the necessary folder permissions as mentioned at the CF installation documentation? (try 775 or 777) - Which type of image are You trying to upoad? (jpg, png, gif, ico etc.) Did you allow the right mime type in the CF backend? - A link to your page would be good to test it. Kind regards, Andy

45 years old and still not smarter lol

Check my GitHub Repos: https://github.com/WebCrew

My CrazyMates Account: https://crazymates.de/Crazymate

Cute but Evil Community: https://cute-but-evil.de

Andy,

Thank you for your reply and suggestions. I tried changing the directory permissions to 775 and 777 but the issue remains. The file does get uploaded to the directory and is renamed without an extension. Not sure if the stripping of the extension is intended or not.

I am trying to upload a jpg image with an extension of .jpg.

My forum is SSL enabled, the url is called via "https" and the hosting site does not have a "tmp" folder. The image being uploaded does not exceed the Admin config setting and the mime type setting is
image/jpg,image/*,text/plain, image/jpeg

Hope that explains it better.

Thanks and regards,

Rab

Andy, Thank you for your reply and suggestions. I tried changing the directory permissions to 775 and 777 but the issue remains. The file does get uploaded to the directory and is renamed without an extension. Not sure if the stripping of the extension is intended or not. I am trying to upload a jpg image with an extension of .jpg. My forum is SSL enabled, the url is called via "https" and the hosting site does not have a "tmp" folder. The image being uploaded does not exceed the Admin config setting and the mime type setting is image/jpg,image/*,text/plain, image/jpeg Hope that explains it better. Thanks and regards, Rab
edited Jan 18 at 6:50 pm

I found this in the php_errors.log file when uploading an image.

[18-Jan-2020 17:45:23 Europe/London] PHP Warning: move_uploaded_file(\5e234433e62fsmile: failed to open stream: Permission denied in D:\home\mysite.com\wwwroot\forum\sys\CODOF\File\Upload.php on line 116
[18-Jan-2020 17:45:23 Europe/London] PHP Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\phpAF3.tmp' to '\5e234433e62f8' in D:\home\mysite.com\wwwroot\forum\sys\CODOF\File\Upload.php on line 116

This is on a shared server and I do not have access to C:\Windows\Temp

Appreciate any suggestions.

Thanks,

Rab

I found this in the php_errors.log file when uploading an image. [18-Jan-2020 17:45:23 Europe/London] PHP Warning: move_uploaded_file(\5e234433e62f8): failed to open stream: Permission denied in D:\home\mysite.com\wwwroot\forum\sys\CODOF\File\Upload.php on line 116 [18-Jan-2020 17:45:23 Europe/London] PHP Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\phpAF3.tmp' to '\5e234433e62f8' in D:\home\mysite.com\wwwroot\forum\sys\CODOF\File\Upload.php on line 116 This is on a shared server and I do not have access to C:\Windows\Temp Appreciate any suggestions. Thanks, Rab

Ok, I have resolved this issue. Since I am on a shared server running IIS on Windows the temp upload directory was C:\Windows\temp

I did not have permissions to this directory so to override this setting I had to use a custom php.ini file. I first created a new directory in my root called "tmp".

The property setting I added to the php.ini file was the following:

upload_tmp_dir = "D:\home\mysite.com\wwwroot\tmp

Everything is working fine now. I hope this helps anyone who runs into the same issue.

FYI, I think Codoforum is great. Cheers.

Rab

Ok, I have resolved this issue. Since I am on a shared server running IIS on Windows the temp upload directory was C:\Windows\temp I did not have permissions to this directory so to override this setting I had to use a custom php.ini file. I first created a new directory in my root called "tmp". The property setting I added to the php.ini file was the following: upload_tmp_dir = "D:\home\mysite.com\wwwroot\tmp Everything is working fine now. I hope this helps anyone who runs into the same issue. FYI, I think Codoforum is great. Cheers. Rab

Thats why I was ask ing You if You have a tmp folder - I had the same problem like You with a other CMS years ago smile and it had to do with a missing tmp folder.

Good to hear that You got rid of that nasty problem smile

Good luck mate smile

Thats why I was ask ing You if You have a tmp folder - I had the same problem like You with a other CMS years ago :) and it had to do with a missing tmp folder. Good to hear that You got rid of that nasty problem :) Good luck mate ;)

45 years old and still not smarter lol

Check my GitHub Repos: https://github.com/WebCrew

My CrazyMates Account: https://crazymates.de/Crazymate

Cute but Evil Community: https://cute-but-evil.de

edited Jan 18 at 11:34 pm
58
5
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft