Index: javascript.php
===================================================================
RCS file: /cvsroot/moodle/moodle/repository/javascript.php,v
retrieving revision 1.65
diff -u -r1.65 javascript.php
--- javascript.php	16 Mar 2009 01:41:26 -0000	1.65
+++ javascript.php	16 Apr 2009 06:34:54 -0000
@@ -770,6 +770,7 @@
 }
 _client.upload = function() {
     var u = _client.ds.upload;
+    u.id += "$suffix";
     var aform = document.getElementById(u.id);
     var parent = document.getElementById(u.id+'_div');
     var d = document.getElementById(_client.ds.upload.id+'-file');
@@ -786,7 +787,7 @@
         parent.appendChild(container);
         YAHOO.util.Connect.setForm(aform, true, true);
         var trans = YAHOO.util.Connect.asyncRequest('POST',
-                '$CFG->httpswwwroot/repository/ws.php?action=upload&sesskey=$sesskey&ctx_id=$context->id&repo_id='
+                '$CFG->httpswwwroot/repository/ws.php?action=upload&itemid='+_client.itemid+'&sesskey=$sesskey&ctx_id=$context->id&&repo_id='
                 +_client.repositoryid,
                 _client.upload_cb);
     }else{
@@ -814,10 +815,10 @@
 _client.uploadcontrol = function() {
     var str = '';
     if(_client.ds.upload) {
-        str += '<div id="'+_client.ds.upload.id+'_div" class="fp-upload-form">';
-        str += '<form id="'+_client.ds.upload.id+'" onsubmit="return false">';
-        str += '<label for="'+_client.ds.upload.id+'-file">'+_client.ds.upload.label+': </label>';
-        str += '<input type="file" id="'+_client.ds.upload.id+'-file" name="repo_upload_file" />';
+        str += '<div id="'+_client.ds.upload.id+'{$suffix}_div" class="fp-upload-form">';
+        str += '<form id="'+_client.ds.upload.id+'$suffix" onsubmit="return false">';
+        str += '<label for="'+_client.ds.upload.id+'{$suffix}-file">'+_client.ds.upload.label+': </label>';
+        str += '<input type="file" id="'+_client.ds.upload.id+'{$suffix}-file" name="repo_upload_file" />';
         str += '<p class="fp-upload-btn"><a href="###" onclick="return repository_client_$suffix.upload();">$strupload</a></p>';
         str += '</form>';
         str += '</div>';
Index: upload/repository.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/repository/upload/repository.class.php,v
retrieving revision 1.11
diff -u -r1.11 repository.class.php
--- upload/repository.class.php	18 Feb 2009 06:52:55 -0000	1.11
+++ upload/repository.class.php	16 Apr 2009 06:34:54 -0000
@@ -26,7 +26,7 @@
         parent::__construct($repositoryid, $context, $options);
         $itemid = optional_param('itemid', '', PARAM_INT);
         if($action=='upload'){
-            $filepath = '/'.uniqid().'/';
+            $filepath = '/';
             $this->info = repository::store_to_filepool('repo_upload_file', 'user_draft', $filepath, $itemid);
         }
     }
