This question is locked. New answers and comments are not allowed.
I'm testing with the Camera Sample project and using the _onPhotoURISuccess callback to call the following function. The image displays fine but I'm getting Null in the Error callback for the FileTransfer upload method for Code, Source and Target.
I've tried the tried using Asp.net Web Api and a regular MVC controller but neither are hit by the FileTransfer upload call.
Thanks,
Brad
I've tried the tried using Asp.net Web Api and a regular MVC controller but neither are hit by the FileTransfer upload call.
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType="image/jpeg";
var params = {};
params.value1 = "test";
params.value2 = "param";
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, encodeURI("http://localhost:50374/photo/upload"), win, fail, options);
}
Thanks,
Brad
9 Answers, 1 is accepted
0

Brad
Top achievements
Rank 1
answered on 30 Dec 2013, 04:47 AM
I used the the solution from the following post http://www.icenium.com/resources/forums/icenium-mist-/in-simulator-my-file-upload-working-but-in-apple-ipad-its-not-working under the link Upload a File to a Remote Server with PhoneGap but I'm having the same issue with getting nulls in the error callback.
I have a regular Asp.NET MVC form that posts a file upload to the the same controller and it's able to hit it fine. It's just from the Graphite IDE.
I have a regular Asp.NET MVC form that posts a file upload to the the same controller and it's able to hit it fine. It's just from the Graphite IDE.
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<
html
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
/>
<
meta
name
=
"format-detection"
content
=
"telephone=no"
/>
<
meta
name
=
"viewport"
content
=
"user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
/>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"css/index.css"
/>
<
title
>Hello World</
title
>
<
script
type
=
"text/javascript"
src
=
"cordova.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"js/index.js"
></
script
>
<
script
type
=
"text/javascript"
charset
=
"utf-8"
>
// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
function onDeviceReady() {
// Do cool things here...
}
function getImage() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('get picture failed');
},{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);
}
function uploadPhoto(imageURI) {
console.log('in the function');
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
console.log('settings parms');
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
options.chunkedMode = false;
alert('transferring...');
var ft = new FileTransfer();
ft.upload(imageURI, "http://localhost:50374/photo/upload", win, fail, options);
}
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
alert(r.response);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
}
</
script
>
</
head
>
<
body
>
<
div
class
=
"app"
>
<
h1
>Apache Cordova</
h1
>
<
div
id
=
"deviceready"
class
=
"blink"
>
<
p
class
=
"event listening"
>Connecting to Device</
p
>
<
p
class
=
"event received"
>Device is Ready</
p
>
</
div
>
</
div
><
br
/><
br
/>
<
button
onclick
=
"getImage();"
>Upload a Photo</
button
>
<
script
type
=
"text/javascript"
>
app.initialize();
</
script
>
</
body
>
</
html
>
0
Accepted
Hi Brad,
Are you testing your code in the simulator or on a device? If you're testing on a device, then you should change "http://localhost" to whatever the actual IP or host name of your development machine is.
Regards,
Stefan
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Are you testing your code in the simulator or on a device? If you're testing on a device, then you should change "http://localhost" to whatever the actual IP or host name of your development machine is.
Regards,
Stefan
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0

Brad
Top achievements
Rank 1
answered on 31 Dec 2013, 02:08 PM
Thanks Stefan!
I was using the emulator but was able to hit the service with the device when pushed to the remote host. I also switched to using the ip address when testing locally but I still can't use the FileTransfer within the simulator - only on the device. I'm guessing this is a limitation with the plugin in the emulator.
Brad
I was using the emulator but was able to hit the service with the device when pushed to the remote host. I also switched to using the ip address when testing locally but I still can't use the FileTransfer within the simulator - only on the device. I'm guessing this is a limitation with the plugin in the emulator.
Brad
0
Accepted
Hi Brad,
The simulator actually does not currently support the File and File Transfer API. I should have noticed this issue in the first place. Support for both in the simulator is coming in the next official release. Here's a list of limitations of the simulator.
Regards,
Stefan
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
The simulator actually does not currently support the File and File Transfer API. I should have noticed this issue in the first place. Support for both in the simulator is coming in the next official release. Here's a list of limitations of the simulator.
Regards,
Stefan
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0

Ramesh
Top achievements
Rank 1
answered on 20 Nov 2014, 11:42 AM
Hi Brad ,
May i Know what are the plugins used for this...
am using Device,camera,console,filetransfer and file
however i cant acces FileTransfer upload call
May i Know what are the plugins used for this...
am using Device,camera,console,filetransfer and file
however i cant acces FileTransfer upload call
0

Ramesh
Top achievements
Rank 1
answered on 20 Nov 2014, 11:43 AM
Hi Brad ,
May i Know what are the plugins used for this...
am using Device,camera,console,filetransfer and file
however i cant acces FileTransfer upload call
Thanks & Regards
Ramesh Sundar
May i Know what are the plugins used for this...
am using Device,camera,console,filetransfer and file
however i cant acces FileTransfer upload call
Thanks & Regards
Ramesh Sundar
0

Brad
Top achievements
Rank 1
answered on 20 Nov 2014, 01:33 PM
Ramesh, I was using the filetransfer and it was a limitation of the simulator. It worked fine on the actual device.
0

Ramesh
Top achievements
Rank 1
answered on 20 Nov 2014, 01:56 PM
Hi Brad,
Thanks for your response
Another think i want to know from you
Am using windows 7, can you tell which simulator is best or suitable to check my app for ipad
Thanks
Robert
Thanks for your response
Another think i want to know from you
Am using windows 7, can you tell which simulator is best or suitable to check my app for ipad
Thanks
Robert
0
Hi Ramesh,
I would recommend the AppBuilder's built in iPad simulator. You can access it, from any of our clients, by changing the device to iPad. Please, refer to this article for more details, about how to run the AppBuilder simulator. And, here you can see how to configure the desired simulated device.
I hope this helps.
Regards,
Kaloyan
Telerik
I would recommend the AppBuilder's built in iPad simulator. You can access it, from any of our clients, by changing the device to iPad. Please, refer to this article for more details, about how to run the AppBuilder simulator. And, here you can see how to configure the desired simulated device.
I hope this helps.
Regards,
Kaloyan
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.