[xiph-commits] r15087 - in trunk/oggPusher: . firefox-extension/chrome/content

nithin at svn.xiph.org nithin at svn.xiph.org
Sun Jun 29 04:31:14 PDT 2008


Author: nithin
Date: 2008-06-29 04:31:13 -0700 (Sun, 29 Jun 2008)
New Revision: 15087

Modified:
   trunk/oggPusher/firefox-extension/chrome/content/op_Window.js
   trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul
   trunk/oggPusher/oggPusher.xpi
Log:
Fixed some typos, Now the Upload is functional

Modified: trunk/oggPusher/firefox-extension/chrome/content/op_Window.js
===================================================================
--- trunk/oggPusher/firefox-extension/chrome/content/op_Window.js	2008-06-29 05:57:02 UTC (rev 15086)
+++ trunk/oggPusher/firefox-extension/chrome/content/op_Window.js	2008-06-29 11:31:13 UTC (rev 15087)
@@ -1,7 +1,7 @@
-var opwindowCommon={
+var opwindowCommon={leafName:null,
 	openFileWindowDialog:function()
         {
-		alert("Inside openFileWindowDialog");
+		//alert("Inside openFileWindowDialog");
 		try{
                 	const nsIFilePicker = Components.interfaces.nsIFilePicker;
 	                var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
@@ -16,6 +16,8 @@
                 if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
                 	var file = fp.file;
          		var path = fp.file.path;
+			alert(fp.file.leafName);
+			this.leafName = fp.file.leafName;
 			parent.document.getElementById("file-path").value = path;
                 }
          },
@@ -38,7 +40,10 @@
 	},
 	uploadFile:function()
 	{
-			var filePath = document.getElementById("file-path").value;
+			var textboxObj = document.getElementById("file-path");
+			//alert(textboxObj);
+			var filePath = textboxObj.value;
+			//alert(filePath);
 			var file = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
 			file.initWithPath(filePath);
 			var fstream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
@@ -54,22 +59,22 @@
 		var boundaryString = 'capitano';
 		var boundary = '--' + boundaryString;
 		var requestbody = boundary + '\n' 
-		+ 'content-Dispostion: form-data; name="fileInput"; filename="'				 + filePath+ '"'+'\n'
+		+ 'Content-Disposition: form-data; name="myfile"; filename="' + this.leafName+ '"'+'\n'
 		+'Content-Type: application/octet-stream'+'\n'
-		+'Content-Transfer-Encoding: binary'+'\n'
 		+ '\n'
 		+ escape(binary.readBytes(binary.available()))
 		+ '\n'
 		+ boundary;
 		
 		
+		alert(requestbody);
 
-
 	        xhr.onreadystatechange = function() { if(this.readyState == 4) {alert(this.responseText)}}
 		xhr.open("POST", "http://www.it.iitb.ac.in/~nithind/post.php", true);
 		xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=\""+ boundaryString + "\"");
-		//xhr.setRequestHeader("Connection", "close");
+		xhr.setRequestHeader("Connection", "close");
 		xhr.setRequestHeader("Content-length", requestbody.length);
+		alert(requestbody.length);
 		xhr.send(requestbody);
 		
 

Modified: trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul
===================================================================
--- trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul	2008-06-29 05:57:02 UTC (rev 15086)
+++ trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul	2008-06-29 11:31:13 UTC (rev 15087)
@@ -5,6 +5,7 @@
     id="op-window"
     title="oggPusher"
     orient="horizontal"
+    xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <!-- Other elements go here --> 
 
@@ -15,7 +16,9 @@
 		<textbox id="file-path" control="browse-button" disabled="true" style="width:400px"/>
       		<button id="browse-button" label="Browse..." oncommand="opwindowCommon.openFileWindowDialog();"/>
 		<button id="upload-button" label="Upload" oncommand="opwindowCommon.uploadFile();"/>
+		
 	</hbox>
+
      </vbox>
 
 </window>

Modified: trunk/oggPusher/oggPusher.xpi
===================================================================
(Binary files differ)



More information about the commits mailing list