$form['image'] = array(
'#type' => 'file',
'#title' => t('Upload Main Image'),
'#default_value' => $node->image,
'#size' => 48,
'#description' => t('Upload Main Image.')
);
I have this in my form, it generates an image upload box. However the image isn't uploading and the name of the file isn't going into the database.
How can i process to this to
a) Get the file name to input into my database
b) Actually make this upload this file to root/files
Incase it is needed the full module can be found below.
<?php
// $Id$
/**
* @file
* Provides a "portfolio" node type.
*/
/**
* Implementation of hook_node_info().
*/
function portfolio_node_info() {
// We return an array since a module can define multiple node types.
// We're only defining one node type, type 'portfolio'.
return array(
'portfolio' => array(
'name' => t('Portfolio'), // Required.
'module' => 'portfolio', // Required.
'description' => t('Add a portfolio item!'), // Required.
'has_title' => TRUE,
'title_label' => t('Title'),
'has_body' => TRUE,
'body_label' => t('Portfolio'),
'locked' => TRUE
)
);
}
/**
* Implementation of hook_menu().
*/
function portfolio_menu($may_cache) {
$items = array();
// Do not cache this menu item during the development of this module.
if (!$may_cache) {
$items[] = array(
'path' => 'node/add/portfolio',