Skip to content

Instantly share code, notes, and snippets.

@neotohin-snippet
Created January 4, 2013 06:56
Show Gist options
  • Save neotohin-snippet/4450496 to your computer and use it in GitHub Desktop.
Save neotohin-snippet/4450496 to your computer and use it in GitHub Desktop.
d7:webform:filesave
Hook Webform Presave: http://drupalcontrib.org/api/drupal/contributions%21webform%21webform.api.php/function/hook_webform_submission_presave/7
Writing to a csv or excel file : http://drupal.org/node/1177352
File Save with entity(Very short and simple code):
$entity = entity_load($id);
$data = file_get_contents($localpath);
$destination = file_create_filename(basename($localpath), file_default_scheme() . '://yourdir/' );
$file = file_save_data($data, $destination);
$entity->field_attachment[LANGUAGE_NONE][] = (array)$file;
$entity->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment