cr_create_content_file (public)

 cr_create_content_file [ -move ] item_id revision_id client_filename

Defined in packages/acs-content-repository/tcl/content-procs.tcl

Copies the file passed by client_filename to the content repository file storage area, and it returns the relative file path from the root of the content repository file storage area.. if the -move flag is given the file is renamed instead

Switches:
-move (optional, boolean)
Parameters:
item_id (required)
revision_id (required)
client_filename (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_cr_items test_cr_items (test xotcl-core) cr_create_content_file cr_create_content_file test_test_cr_items->cr_create_content_file test_xotcl_core_tutorial_4 xotcl_core_tutorial_4 (test xotcl-core) test_xotcl_core_tutorial_4->cr_create_content_file cr_add_to_file_creation_log cr_add_to_file_creation_log (private) cr_create_content_file->cr_add_to_file_creation_log cr_create_content_file_path cr_create_content_file_path (public) cr_create_content_file->cr_create_content_file_path cr_fs_path cr_fs_path (private) cr_create_content_file->cr_fs_path content::revision::update_content-file content::revision::update_content-file (private) content::revision::update_content-file->cr_create_content_file content::revision::update_content-lob content::revision::update_content-lob (private) content::revision::update_content-lob->cr_create_content_file fs::file_copy fs::file_copy (public) fs::file_copy->cr_create_content_file pa_load_images pa_load_images (public) pa_load_images->cr_create_content_file packages/general-comments/www/file-add-2.tcl packages/general-comments/ www/file-add-2.tcl packages/general-comments/www/file-add-2.tcl->cr_create_content_file

Testcases:
xotcl_core_tutorial_4, test_cr_items
Source code:
    #
    # A malicious user may try to sneak a symlink in the content
    # repository, for instance, via a zip file upload. We want to
    # prevent this.
    #
    file lstat $client_filename file_info
    if {$file_info(type) eq "link"} {
        error "Attempt to store a symlink in the content repository!"
    }

    set content_file [cr_create_content_file_path $item_id $revision_id]
    set dir [cr_fs_path]

    if { $move_p } {
        file rename -- $client_filename $dir$content_file
    } else {
        file copy -force -- $client_filename $dir$content_file
    }

    cr_add_to_file_creation_log $content_file

    return $content_file
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: