Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've spending a ton of time pouring over documentation and examples but can't seem to figure out just how to upload a file through a form. All I need to do is upload a file through a form on the module's settings page and pass it to a function that processes that file and then I don't ever need to see the file again. Can someone please help? Any and all is much appreciated. Thanks.
ok - i deleted the tinymce tables from my database -- but now no matter what i do, i can't get the install to create the tables again... anyone know how to do this?
I have been trying to allow my module to upload images for the past few days and am getting very frusterated. I was reading through this thread: http://drupal.org/node/53621 and everything I'm doing looks to match this exactly. Since I still havn't been able to get it to work, I tried copying the code from the image.module directly into my module. (I can upload images correctly through image.module).
Right now I am only focusing on getting the hook_update part to work.
I have the following code:
<?php
function surgeon_form(&$node) {
$form['image'] = array('#type' => 'file', '#title' => t('Image'), '#description' => t('Click "Browse..." to select an image to upload.'));
return $form;
}
function surgeon_update(&$node) {
foreach ($node->images as $label => $image) {
$old_path = db_result(db_query("SELECT filepath FROM {files} WHERE filename='%s' AND nid=%d", $label, $node->nid));
if ($old_path != $image) {
//-------------------
//THE CODE GETS HERE AND STOPS. I DONT THINK IT
//HAS ANYTHING IN THE IMAGE VARIABLE
//THE SURGEONS DB_QUERY BELOW DOES NOT
//GET EXECUTED
//-------------------
db_query("UPDATE surgeons set tid = 55 where nid = 29"); //this does not get executed
file_delete(file_create_path($old_path));
db_query("DELETE FROM {files} WHERE filename='%s' AND nid=%d", $label, $node->nid);
I'd like to know how to create new module's extensions for Drupal correctly?
For example I want to develop my customized forum but based on existing core forum.module logics.
How do I extend its functionality in accordance to my demand?
Do I grab forum functions code to my megaforum.module and change it? Or in what other way I have to do?