Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Content Editor Discussions

Forum for content editors and CMS users.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

File upload error


Reply

5 Posts   711 Views

Avatar
spekulatius

14 March 2014 at 3:50pm Community Member, 5 Posts

When I try to upload a picture in the "Files" Section on the admin section I get an error (little black on screen box: "Internal Server Error"). When I check my logs I find the following line:

[Fri Mar 14 14:40:35 2014] [warn] [client 203.xxx.yyy.zzz] mod_fcgid: stderr: PHP Fatal error: Call to a member function getFilename() on a non-object in /var/www/clients/client1234/web5678/web/framework/forms/UploadField.php on line 1279, referer: http://abc.co.nz/admin/assets/add/?ID=0

Did anyone have the same issue?

Avatar
ivancro

19 March 2014 at 3:49am Community Member, 1 Post

I have the same error in logs. SS version 3.1.3.
But when I set display_errors in php.ini to "On" upload works fine without any error.

Avatar
okotoker

23 March 2014 at 6:02pm Community Member, 41 Posts

Same here, went back to 3.1.2 and it works fine

Avatar
sashion

24 March 2014 at 11:57pm Community Member, 23 Posts

Hey guys,

had the same problem. here´s the fix:
https://github.com/silverstripe/silverstripe-framework/commit/279b927df1c0bb291c7d57e0e8836c27b3694364

cheers,
sash

Avatar
spekulatius

13 September 2014 at 10:20am (Last edited: 13 September 2014 10:21am), Community Member, 5 Posts

While reviewing some of my SilverStripe projects I came a cross this issue I had and found the fix I used could be useful to share. I used this solution: [url=http://thaleikis.de/php/silverstripe/silverstripe-cms-file-upload-causes-internet-server-error/]File Upload issue in SilverStripe CMS[/url]. I adjusted the SilverStripe Framework file framework/filesystem/Folder.php to this:

public static function find_or_make($folderPath) {
// Create assets directory, if it is missing
if(!file_exists(ASSETS_PATH)) Filesystem::makeFolder(ASSETS_PATH);

/**
* Bugfix by Peter Thaleikis
* This solves the issue with 'Internal Server Error' on some shared webhosting packages.
*/
if ($folderPath == '/') $folderPath = ASSETS_PATH;
/**
* End of the fix
*/

$folderPath = trim(Director::makeRelative($folderPath));
// replace leading and trailing slashes
$folderPath = preg_replace('/^\/?(.*)\/?$/', '$1', $folderPath);
$parts = explode("/",$folderPath);

to fix it :)