function success(response) {
alert("4");
};
// callback if the photo fails to upload successfully.
function fail(error) {
alert("3" + error.code);
};
function uploadPhoto()
{
var imageFile = document.getElementById("test_img").src;
alert("1" + imageFile);
var ft,options;
options = new FileUploadOptions();
options.fileKey = "profile_image";
// name of the file:
options.fileName = imageFile.substr(imageFile.lastIndexOf('/') + 1);
// mime type:
options.mimeType = "multipart/form-data";
params = {
val1: "some value",
val2: "some other value"
};
options.params = params;
ft = new FileTransfer();
ft.upload(imageFile, 'http://192.168.123.199/saveImage.php', success, fail, options,false);
alert("2 " + imageFile);
};
i see alert 1,2 and then nothing
my php code
<?php// Directory where uploaded images are saved
$target_path = "tmp/";
$target_path = $target_path . basename( $_FILES['profile_image']['name']);
if(move_uploaded_file($_FILES['profile_image']['name'], $target_path)) {
echo "The file ". basename( $_FILES['profile_image']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
my logcat
08-02 23:21:05.835: D/FileTransfer(16094): upload content://media/external/images/media/1889 to http://192.168.123.199/saveImage.php
08-02 23:21:05.835: D/FileTransfer(16094): fileKey: profile_image
08-02 23:21:05.835: D/FileTransfer(16094): fileName: 1889
08-02 23:21:05.835: D/FileTransfer(16094): mimeType: multipart/form-data
08-02 23:21:05.835: D/FileTransfer(16094): params: {"val1":"some value","val2":"some other value"}
08-02 23:21:05.835: D/FileTransfer(16094): trustEveryone: false
08-02 23:21:05.835: D/FileTransfer(16094): chunkedMode: true
08-02 23:21:08.740: D/dalvikvm(16094): GC_CONCURRENT freed 252K, 48% free 3122K/5959K, external 882K/1314K, paused 8ms+14ms
Where i change it to base 64?
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to www.phonegap.com
To compile in the cloud, check out build.phonegap.com
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to www.phonegap.com
To compile in the cloud, check out build.phonegap.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to www.phonegap.com
To compile in the cloud, check out build.phonegap.com
function win(r) { //File Uoload - Ends |
|
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, targetWidth: 300, targetHeight:200,destinationType : Camera.DestinationType.FILE_URI }); Details of ASMX Files:
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace WebService1
{ /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod]
public string SaveImage() { HttpPostedFile file = HttpContext.Current.Request.Files["recFile"]; if (file == null) return null; string targetFilePath = "c:\\deposit\\" + file.FileName; file.SaveAs(targetFilePath); return file.FileName.ToString(); } } } Thanks in Advance.
Suresh
|
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to www.phonegap.com
To compile in the cloud, check out build.phonegap.com
To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
Attached as image.