Drupal file upload: file_save_upload
Drupal's file_save_upload function saves an uploaded file to a new location as specified in the parameter of the function.
Syntax:
Drupal 5: file_save_upload($source, $dest = FALSE, $replace = FILE_EXISTS_RENAME)
Drupal 6: file_save_upload($source, $validators = array(), $dest = FALSE, $replace = FILE_EXISTS_RENAME)
Drupal 7: file_save_upload($source, $validators = array(), $destination = FALSE, $replace = FILE_EXISTS_RENAME)
- $source: This will be the field name using which the file is being uploaded.
- $validators: This is an associative array of callback functions which validate the uploaded file. The function names are keys and and values of the array will be any arguments to be passed to the function callback
- $dest: The location where the file specified in $source should be copied to. If set to FALSE or not writable, temporary directory will be used to copy the file
- $replace: This is a kind of flag which decides what to do when a file with same name is already there. Setting this value to FALSE will make sure that all the files will have unique names.
(2 votes)
- 2073 reads
-
Your feedback





Recent comments
8 weeks 4 days ago
27 weeks 1 day ago
28 weeks 6 days ago
38 weeks 2 days ago
42 weeks 4 days ago
43 weeks 5 days ago
43 weeks 5 days ago
43 weeks 5 days ago
43 weeks 5 days ago
44 weeks 1 day ago