CSCart File Uploader

Hey I'm working on a document management add-on for cs-cart and I am running into some issues with the native file uploader (comment_templates/fileuploader.tpl). For some reason, when I select a local file from the list, it only gets selected/uploaded half the time. I noticed if I open an edit window (in my addon), close it, open an add window (also in addon), and close it, then go back to add/edit and it will work fine.



Here is an example of the empty(ish) array:



array i[/i]

'file_template_data' =>

array i[/i]

'name' =>

array i[/i]

'file' => string '' i[/i]

'type' =>

array i[/i]

'file' => string '' i[/i]

'tmp_name' =>

array i[/i]

'file' => string '' i[/i]

'error' =>

array i[/i]

'file' => int 4

'size' =>

array i[/i]

'file' => int 0





Most of the time my $_FILES array will have a few empty fields in it, unless I do the open/close thing, in which case the $_FILES array would display correctly.



My include call is pretty straight forward, I don't know if I am missing anything.



{include file="common_templates/fileuploader.tpl" var_name="template_data[file]"}




Also, can somebody explains what happens when a file is uploaded via the server link (instead of the local or url links). The file shows up in the list of files to be uploaded in the fileuploader.tpl, but once I hit submit I get another empty $_FILES array. Is that info stored somewhere else since it is already on the server?