thanks, but that didn't help. I still just get "Bad Request" I don't get how I'm meant to debug this..
FIX
I moved all my files to a new site and finally found the drag and drop stopped when i updated my custom Page.php
It didnt like:
public static $has_one = array(
'MenuImg' => 'Image'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$uploadField = new UploadField('MenuImg', 'Menu Image');
$fields->addFieldToTab('Root.MenuImage', $uploadField);
$uploadField->setFolderName('menuphotos');
return $fields;
}
this created a 'bad request' so removed the code and reworked it for another page type and it works..
EDIT
So I get this Bad Request error by having Image Upload fields in my Page.php code
This is my code, can any body see what im doing wrong or suggest how to have these fields on every page another way?
<?php
class Page extends SiteTree {
public static $db = array(
'Ad1Link' => 'Text',
'Ad2Link' => 'Text',
'Ad3Link' => 'Text',
'Ad1Title' => 'Text',
'Ad2Title' => 'Text',
'Ad3Title' => 'Text'
);
public static $has_one = array(
'Ad1' => 'Image',
'Ad2' => 'Image',
'Ad3' => 'Image'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Adverts',$uploadField = new UploadField($name = 'Ad1',$title = 'Advert 1 (239px X 165px)'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad1Link','Advert 1 Link'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad1Title','Advert 1 Title'));
$fields->addFieldToTab('Root.Adverts',$uploadField = new UploadField($name = 'Ad2',$title = 'Advert 2 (239px X 165px)'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad2Link','Advert 2 Link'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad2Title','Advert 2 Title'));
$fields->addFieldToTab('Root.Adverts',$uploadField = new UploadField($name = 'Ad3',$title = 'Advert 3 (239px X 165px)'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad3Link','Advert 3 Link'));
$fields->addFieldToTab('Root.Adverts', TextField::create('Ad3Title','Advert 3 Title'));
return $fields;
}
}
class Page_Controller extends ContentController {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
public function init() {
parent::init();
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS('reset');
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
}
}
EDIT 2
So if I remove my has_one images from the code I no longer get a bad request when drag and dropping other images and data on the site. This seems to be directly relate to the fact its in my Page.php code... any ideas what I should do?