Hmm, I'll look into it. Many thanks for the great idea.

2012. július 8., vasárnap 17:28:58 UTC+2 időpontban Niphlod a következőt 
írta:
>
> Using session is the simplest way to go.... before "opening" the editform 
> of the post you'd have to (clear and) save in session some identifier of 
> the post that is going to be edited and use that to "tag" every row of the 
> uploads.
>
> On Saturday, July 7, 2012 11:17:19 PM UTC+2, Athelionas wrote:
>>
>> Let's suppose we have a page for creating blog posts with a form with 
>> text area transformed into an editor. That editor has properly configured 
>> custom upload mechanism meaning that it uses a controller function such as 
>> upload_file() and it also has a view which is only needed to run some 
>> javascript needed by CKEditor. Then let's also suppose we have a database 
>> table containing blog posts, another table containing information about 
>> uploaded files, and yet another table used for defining a many-to-many 
>> relation between posts and files. So every post can have files and every 
>> file might belong to several posts.
>>
>> Now comes the tricky part. When we upload an arbitrary number of images, 
>> edit the post, and press submit button we'd want to indicate in the DB that 
>> the uploaded file belongs to the blog post which has just been created. 
>> This is useful to prevent accidental deletion of files still used by some 
>> of the blogs.
>>
>> Handling the blog post form and the upload separately so both the post 
>> and the files get into the right table is piece of cake. But how do we 
>> handle the intermediate table? How should we insert data about their 
>> relationship into the table? Problem arises from the fact that uploading 
>> the image and editing the post happen in different controllers and 
>> different views, so in this case we cannot just use forms and the DAL to 
>> make things work, or at least it's not a trivial task. 
>>
>> Yep, you guessed right, the question is how should we do this?
>>
>

Reply via email to