In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
43 [In-Portal CMS] Admin Interfaces bug report always 2009-06-03 14:30 2012-07-25 05:29
alex  
alex  
normal  
closed 5.1.0  
fixed  
 
none 5.2.0  
https://groups.google.com/d/topic/in-portal-bugs/B-MB2l-Qijw/discussion
Fixes early file upload
2
0000043: SWFUploader and "Save" button.
When "inp_edit_swfupload" block is used on form, then selected files are actually uploaded in two cases:
1. when "upload" button is pressed (under uploader control)
2. when "save" button is pressed (on top of form)

By default SWFUploader uploads files in temp directory ("/system/tmp") and when saving record to database ("save" button pressed) is moving uploaded files from temp directory to actual directory, specified in unit config.

But, when we have some invalid data on form, like required field value is not entered and "save" button is pressed, then we are returned to form with validation errors displayed, but are already uploaded to target directory.

Files, uploaded to temp directory should only be moved to target directory when "save" button is pressed and there are not validation errors on form.
This is what happens in what order:
1. OnSave event is called.
2. withing OnSave event method "kDBItem::SetFieldsFromHash" is called
3. method "kDBItem::SetFieldsFromHash" calls "kUploadFormatter::Parse" method
Last of mentioned methods actually performs file moving from temp directory to target directory.

And only after that form validation happens when "OnPreSave" event is called.

So Parse method actually doesn't know anything about validation result, because no validation happened at that moment.

Instead of actually moving files I propose to put moving operations to "<prefix_special>_pending_actions_<m_wid>" variable (it is kind of queue).

Queue processing should be made in OnSave event (when temporary tables are used) and in OnAfterItemUpdate/OnAfterItemCreate (when temporary tables are not used).

----

By no "pending_actions" variable is used only to schedule uploaded file deletion operation. This processing should be joined with file moving and centrally processed in one place.
related to 0000955closed  (5.1.2)alex Strange error, while using flash uploader 
related to 0000870closed  (5.1.2)alex Queuing events to uploader fails, when flash object isn't yet loaded 
related to 0000835needs work  (Icebox)alex New 5.1.0 style flash uploader porting to Front-End 
related to 0000044closed  (5.1.3)alex "Files" are NOT Deleted when Editing Sub-Items 
related to 0001061needs work  (Icebox)!COMMUNITY Ability to enter inline description for files in Flash Uploader 
related to 0001068closed  (5.1.3)alex Inability to use non-latin characters in flash uploader "Browse" button 
related to 0001355closed  (5.2.0)alex Ability to update only given fields via kDBItem::Update method 
patch flash_uploader_tmp_folder_fix_513.patch (29,133) 2012-07-15 14:47
http://tracker.in-portal.org/file_download.php?file_id=1743&type=bug
patch flash_uploader_tmp_folder_fix_520.patch (35,814) 2012-07-16 05:46
http://tracker.in-portal.org/file_download.php?file_id=1745&type=bug
patch uploader_onafteritemupdate_fix.patch (1,959) 2012-07-16 11:45
http://tracker.in-portal.org/file_download.php?file_id=1752&type=bug
patch form_manager_and_flash_uploader_fix.patch (448) 2012-07-19 04:47
http://tracker.in-portal.org/file_download.php?file_id=1764&type=bug
patch subscription_creation_fatal_error_fix.patch (2,090) 2012-07-24 05:32
http://tracker.in-portal.org/file_download.php?file_id=1772&type=bug
Issue History
2012-07-25 05:29 alex Note Added: 0004820
2012-07-25 05:29 alex Status resolved => closed
2012-07-24 05:34 alex Changeset attached 5.2.x r15474
2012-07-24 05:33 alex Note Added: 0004819
2012-07-24 05:32 alex File Added: subscription_creation_fatal_error_fix.patch
2012-07-19 04:59 alex Relationship added related to 0000835
2012-07-19 04:48 alex Changeset attached 1.0.x r15463
2012-07-19 04:48 alex Note Added: 0004808
2012-07-19 04:47 alex File Added: form_manager_and_flash_uploader_fix.patch
2012-07-16 11:47 alex Changeset attached 5.2.x r15455
2012-07-16 11:47 alex Note Added: 0004790
2012-07-16 11:45 alex File Added: uploader_onafteritemupdate_fix.patch
2012-07-16 11:38 alex Relationship added related to 0001355
2012-07-16 05:53 alex Note Added: 0004781
2012-07-16 05:53 alex Status reviewed and tested => resolved
2012-07-16 05:53 alex Fixed in Version => 5.2.0
2012-07-16 05:53 alex Resolution open => fixed
2012-07-16 05:53 alex Assigned To !COMMUNITY => alex
2012-07-16 05:53 alex Changeset attached 5.2.x r15446
2012-07-16 05:46 alex File Added: flash_uploader_tmp_folder_fix_520.patch
2012-07-16 05:45 alex File Deleted: flash_uploader_tmp_folder_fix_520.patch
2012-07-16 05:35 alex Note Added: 0004780
2012-07-16 05:35 alex Status needs testing => reviewed and tested
2012-07-16 05:34 alex Target Version Icebox => 5.2.0
2012-07-15 15:16 alex Note Added: 0004779
2012-07-15 15:16 alex Assigned To alex => !COMMUNITY
2012-07-15 15:16 alex Developer => alex
2012-07-15 15:16 alex Status needs work => needs testing
2012-07-15 14:50 alex File Added: flash_uploader_tmp_folder_fix_520.patch
2012-07-15 14:47 alex File Added: flash_uploader_tmp_folder_fix_513.patch
2012-07-15 14:47 alex Note Deleted: 0004778
2012-07-15 14:47 alex File Deleted: flash_uploader_tmp_folder_fix_513.patch
2012-07-15 13:36 alex Note Added: 0004778
2012-07-15 05:59 alex File Added: flash_uploader_tmp_folder_fix_513.patch
2012-07-11 14:30 alex Reference => https://groups.google.com/d/topic/in-portal-bugs/B-MB2l-Qijw/discussion
2012-07-11 14:30 alex Change Log Message => Fixes early file upload
2012-07-11 14:30 alex Estimate Points => 2
2012-01-11 08:11 alex Relationship added related to 0000870
2012-01-11 08:10 alex Relationship added related to 0000955
2011-05-28 15:07 alex Relationship added related to 0001068
2011-05-28 14:55 alex Relationship added related to 0001061
2010-12-06 12:34 alex Relationship added related to 0000044
2010-09-06 11:33 Dmitry Note Added: 0002777
2010-09-06 05:30 alex Note Added: 0002772
2010-09-06 05:30 alex Status needs feedback => needs work
2010-09-05 20:59 Dmitry Note Added: 0002770
2010-09-05 20:59 Dmitry Status needs work => needs feedback
2010-08-31 14:25 alex Status active => needs work
2010-08-31 14:25 alex version => 5.1.0
2009-10-03 07:54 administrator Status reviewed and tested => active
2009-09-20 15:17 alex Target Version 5.1.0 => Icebox
2009-08-03 15:53 Dmitry Assigned To => alex
2009-08-03 15:53 Dmitry Status active => reviewed and tested
2009-08-03 15:53 Dmitry Target Version 5.0.1 => 5.1.0
2009-06-07 06:39 alex Reproducibility @70@ => always
2009-06-06 23:13 Dmitry Target Version => 5.0.1
2009-06-03 14:31 alex Additional Information Updated bug_revision_view_page.php?rev_id=28#r28
2009-06-03 14:30 alex New Issue

Notes
(0002770)
Dmitry   
2010-09-05 20:59   
Is this still active? I believe by today we have changed Uploder quite a bit.
(0002772)
alex   
2010-09-06 05:30   
Yes, it's active. I supposed, that the answer was obvious to you, since you've tested all that tasks, that changed an uploader.
(0002777)
Dmitry   
2010-09-06 11:33   
Reminder sent to: alex

Yeah, you are right - I must read the whole task before asking. Now I see that issue is still active and needs to be addressed.

Thanks.
(0004779)
alex   
2012-07-15 15:16   
What was done:
1. info about all uploaded/deleted, both temp and live, files is stored in session
2. when user deletes file that he just uploaded (before saving changes to db), then file was always deleted from live folder (and not temp one as it should).
(0004780)
alex   
2012-07-16 05:35   
Will test all together later.
(0004781)
alex   
2012-07-16 05:53   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0000043: SWFUploader and "Save" button.
(0004790)
alex   
2012-07-16 11:47   
Patch "uploader_onafteritemupdate_fix.patch" along with 0001355 task solves problem with kDBItem changed fields not being detected in OnAfterItemUpdate event.
(0004808)
alex   
2012-07-19 04:48   
In this task I've changed what hidden fields are used to transfer uploaded file into back to server and "tmp_names" hidden field no longer exists.

JavaScript class FormManager, who used it also stopped working because of that. Fix for it is attached in "form_manager_and_flash_uploader_fix.patch" patch.
(0004819)
alex   
2012-07-24 05:33   
Patch "subscription_creation_fatal_error_fix.patch" fixes problem when after creation of subscription-type product SQL error ending with "...ItemResourceId=)..." was thrown.
(0004820)
alex   
2012-07-25 05:29   
Since 5.2.0 version was released.