Monday 01 March 2010 2:17:27 am
Hi, i'm currently developing a complex issue regarding nodes creation and ezBinaryFile attribute. The idea is to let the users create a new node that has a file type attribute, but this file is not uploaded by the user but created on the server-side once the user has filled the form. The content of this file will be a string generated when the user is creating it. This string would reach the kernel as a post variable, like any other attribute. Then, when the user creates a node of this type, I need to create an ezBinaryFile , fill it with the string, and set it as an attribute of the new node. I think that the different stages of this flow will be:
1. Create object as usual -> action.php
2. Form with all attributes -> edit/obj_id/version
action of this form goes to the same edit.php.. so i think here is where I should:
a) create the file on the server side
b) store the node
I guess that creating the file implies creating a temporary one and then call to ezbinaryfiletype::insertRegularFile, because the content of the destination file is filled copying directly the source file to the destination: copy( $filePath, $destination ); but in my case, there is no source file but source string.. is there any function that does it in ez framework? Then I would be able to create the node from the attributes, but i'm not sure how to do it... actually it is not create but edit, as i understood. This editing is peformed on conten/edit.php, where i think i should call to the file creation function. Is this ok? Sorry for the large post, but i'm a bit confused and i need experts opinion on this complex issue. Thank you!
|