Remaining FileUploader to FileTransfer

This commit is contained in:
macdonst 2011-01-06 22:57:54 +08:00
parent 1eae6786c4
commit 8d513e2765
3 changed files with 11 additions and 11 deletions

View File

@ -7,9 +7,9 @@
*/ */
/** /**
* FileUploader uploads a file to a remote server. * FileTransfer uploads a file to a remote server.
*/ */
function FileUploader() {}; function FileTransfer() {};
/** /**
* FileUploadResult * FileUploadResult
@ -21,15 +21,15 @@ function FileUploadResult() {
}; };
/** /**
* FileUploadError * FileTransferError
*/ */
function FileUploadError() { function FileTransferError() {
this.code = null; this.code = null;
}; };
FileUploadError.FILE_NOT_FOUND_ERR = 1; FileTransferError.FILE_NOT_FOUND_ERR = 1;
FileUploadError.INVALID_URL_ERR = 2; FileTransferError.INVALID_URL_ERR = 2;
FileUploadError.CONNECTION_ERR = 3; FileTransferError.CONNECTION_ERR = 3;
/** /**
* Given an absolute file path, uploads a file on the device to a remote server * Given an absolute file path, uploads a file on the device to a remote server
@ -40,7 +40,7 @@ FileUploadError.CONNECTION_ERR = 3;
* @param errorCallback {Function} Callback to be invoked upon error * @param errorCallback {Function} Callback to be invoked upon error
* @param options {FileUploadOptions} Optional parameters such as file name and mimetype * @param options {FileUploadOptions} Optional parameters such as file name and mimetype
*/ */
FileUploader.prototype.upload = function(filePath, server, successCallback, errorCallback, options) { FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options) {
// check for options // check for options
var fileKey = null; var fileKey = null;
@ -59,7 +59,7 @@ FileUploader.prototype.upload = function(filePath, server, successCallback, erro
} }
} }
PhoneGap.exec(successCallback, errorCallback, 'FileUploader', 'upload', [filePath, server, fileKey, fileName, mimeType, params]); PhoneGap.exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params]);
}; };
/** /**

View File

@ -284,7 +284,7 @@ public class DroidGap extends PhonegapActivity {
this.addService("Notification", "com.phonegap.Notification"); this.addService("Notification", "com.phonegap.Notification");
this.addService("Storage", "com.phonegap.Storage"); this.addService("Storage", "com.phonegap.Storage");
this.addService("Temperature", "com.phonegap.TempListener"); this.addService("Temperature", "com.phonegap.TempListener");
this.addService("FileUploader", "com.phonegap.FileUploader"); this.addService("FileTransfer", "com.phonegap.FileTransfer");
} }
/** /**

View File

@ -28,7 +28,7 @@ import android.webkit.CookieManager;
import com.phonegap.api.Plugin; import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult;
public class FileUploader extends Plugin { public class FileTransfer extends Plugin {
private static final String LOG_TAG = "FileUploader"; private static final String LOG_TAG = "FileUploader";
private static final String LINE_START = "--"; private static final String LINE_START = "--";