diff --git a/files/css/files.css b/files/css/files.css
index 8ab07d452414464a1a0f7f5e73e9505397c57d55..160c930740919613fc7255f254641bc1f4dff60d 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -19,6 +19,14 @@
     text-decoration: none;
 }
 
+#file_upload_form {
+	display: none;
+}
+
+#file_upload_target {
+	display: none;
+}
+
 /* FILE TABLE */
 
 table td.filesize, table td.date
diff --git a/files/index.php b/files/index.php
index a68ae9c0bb48b68e0e97d5c2ca303e9c3bd7af23..7f6a11ff03c0283087c6baaa779795ca9e0d4844 100644
--- a/files/index.php
+++ b/files/index.php
@@ -59,6 +59,7 @@ foreach( explode( "/", $dir ) as $i ){
 $tmpl = new OC_TEMPLATE( "files", "index", "user" );
 $tmpl->assign( "files", $files );
 $tmpl->assign( "breadcrumb", $breadcrumb );
+$tmpl->assign( 'dir', $dir);
 $tmpl->printPage();
 
 ?>
diff --git a/files/js/files.js b/files/js/files.js
index 9ab573ee92b381c8d1ce373cb512e3061f97358e..ba08e254349a13c11ef10ef745e8896761f073e6 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -36,4 +36,25 @@ $(document).ready(function() {
             // Uncheck all
             $('.browser input:checkbox').attr('checked', false);
     });
+	
+	// Shows and hides file upload form
+    $('#file_upload_button').toggle(function() {
+		$('#file_upload_form').css({"display":"block"});
+    }, function() {
+		$('#file_upload_form').css({"display":"none"});
+	});
+	
+	$('#file_upload_start').click(function() {		
+		$('#file_upload_target').load(uploadFinished);
+	});
 });
+
+function uploadFinished() {
+	result = $('#file_upload_target').contents().text();
+	result = eval("(" + result + ");");
+	if(result.status == "error") {
+		alert('An error occcured, upload failed.');
+	} else {
+		location.href = 'index.php?dir=' + $('#dir').val();
+	}
+}
diff --git a/files/templates/index.php b/files/templates/index.php
index f1fdafc27cc824e21bfd20342635238875850e91..94d3769c9acffda2ba5866c1b55017b200ebb09b 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -7,8 +7,20 @@
 
 <div class="controls">
 	<p class="actions">
-		<a href="" title="" class="upload">Upload</a><a href="" title="" class="new-dir">New folder</a><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a>
+		<a href="" title="" class="upload" id="file_upload_button">Upload</a><a
+href="" title="" class="new-dir">New folder</a><a href="" title=""
+class="download">Download</a><a href="" title="" class="share">Share</a><a
+href="" title="" class="delete">Delete</a>
 	</p>
+	<div id="file_upload_form">
+		<form action="ajax/upload.php"
+method="post" enctype="multipart/form-data" target="file_upload_target"><input
+type="hidden" name="MAX_FILE_SIZE" value="2097152" id="max_upload"><input
+type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input
+type="file" name="file" id="fileSelector"><input type="submit"
+id="file_upload_start" value="Upload" /><iframe id="file_upload_target"
+name="file_upload_target" src=""></iframe></form>
+	</div>
 </div>
 
 <p class="nav">