17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 823 Views |
-
File Uploads

8 June 2008 at 10:42pm Last edited: 8 June 2008 11:21pm
I am trying to add a tab to a page type called "Files", that will allow the user to upload a PDF (just one) that will attach to the page, so I can access it and place a link to it in a certain box in my .ss files.
class Tour extends Page {
static $db = array(
);
static $has_one = array(
'PDF' => 'File'
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab( 'Root.Content.Files', new FileIFrameField('PDF', 'Upload and Attach Dossier PDF') );
return $fields;
}1. This code displays an "Attach Image" Iframe, which is a little confusing
2. When a file is selected (a pdf) and "attach image" button is hit, page refreshes but nothing happens. No Mime Type image (not sure if there should be) and no confirmation.
3. File is present in Assets directory under "Uploads"
4. There is no link to the file in the Database, and accessing it from the template gives nothing.Any help please. There is only two other posts on this forum, one has very similar code to what I have above, and claims that it works. The other simply wasn't answered. The docs tell me nothing.
Cheers
Aaron -
Re: File Uploads

8 June 2008 at 11:23pm
Cancel that - the above code works. I had a slight spelling error on the file field name in my running code.
| 823 Views | ||
|
Page:
1
|
Go to Top |

