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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Content Editor Discussions /

Forum for content editors and CMS users.

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

File upload error


Go to End


5 Posts   3976 Views

Avatar
spekulatius

Community Member, 5 Posts

14 March 2014 at 3:50pm

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

Community Member, 1 Post

19 March 2014 at 3:49am

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

Community Member, 50 Posts

23 March 2014 at 6:02pm

Same here, went back to 3.1.2 and it works fine

Avatar
sashion

Community Member, 25 Posts

24 March 2014 at 11:57pm

Avatar
spekulatius

Community Member, 5 Posts

13 September 2014 at 10:20am

Edited: 13/09/2014 10:21am

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: File Upload issue in SilverStripe CMS. 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 :)