Created
January 4, 2013 06:56
-
-
Save neotohin-snippet/4450496 to your computer and use it in GitHub Desktop.
d7:webform:filesave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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