Page 1 of 2
Signature/Camera image not uploading
Posted: Fri Nov 09, 2012 5:04 pm
by Paul_Ramcharitar
With the realease of profoundui 4.1.6, I decided to try:
(1) The "pui.uploadSignature" method, to upload a signature as an image from the signature pad widget.
(2) The "pui.capturePhoto" method, to capture and upload photos from the device's camera.
However, the image isn't uploading. I keep getting an alert box that says "undefined", when I try both methods.
I have set my PUIUPLEXIT program to allow uploads.
Re: Signature/Camera image not uploading
Posted: Fri Nov 09, 2012 5:40 pm
by Scott Klement
There was a change to the way errors were communicated starting in PUI 4.1.5.
I suspect you've updated your IBM i server (installed 4.1.6 of ProfoundUI) but are still using the old version (4.1.4 or earlier) in the mobile app.
Inside your assets/www directory (in your phonegap dev environment) you'll see that there's a file called "runtime.js". This is the ProfoundUI runtime. when you upgrade the server, you need to replace that runtime.js with the new version, and re-generate your mobile apps.
You can get the server file from your IFS, it's under
/www/YOUR-HTTP-INSTANCE/htdocs/profoundui/proddata/js
Just copy it into the assets/www directory of your project (replacing the old one) and then re-generate your app. I think it'll solve the problem.
Let me know how that works out.
Re: Signature/Camera image not uploading
Posted: Fri Nov 09, 2012 6:46 pm
by jac53
Hi Paul:
After you copied the runtime.js Did you issues were fixed?
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 10:41 am
by Paul_Ramcharitar
I had already placed the latest copy of runtime.js (4.1.6) in the assets directory of the app. I did it again just to be sure, but I'm still getting the "undefined" error. Here is my takePicture() function:
Code: Select all
function takePicture() { // this is called from the display file using the onclick event
pui.capturePhoto({
dir: "/www/profoundui/htdocs/profoundui/userdata/images/CustImages",
fileName: "CSPIC.jpg", // we're using a hard-coded file name; use the get() API for a dynamic file name
overwrite: true,
handler: function(response) {
if (response.success) pui.click(); // submit the screen on success
else alert(response.error); // otherwise, display the error message returned from the API
}
});
}
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 11:00 am
by jac53
Thank you Paul. I feel better now, not being the only one. :)
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 12:39 pm
by Scott Klement
Obviously, there's a bug here somehwere... trying to figure it out.
This string (from your log): "{'success':false,'key':'prevented'}" means that the upload was prevented by the exit program -- in other words, the exit program is not setting the "allow" flag to a 1.
But, the runtime.js should be translating that to say "Operation prevented by exit program." for you to see. This must be a bug in the pui.capturePhoto API...
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 3:18 pm
by Paul_Ramcharitar
Hi Scott,
The exit program (PUIUPLEXIT) already has: Allow = 1; This is without any conditions.
I was able to test it by uploading an image from my app, to the IFS, using a php script, and the upload was successful.
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 4:54 pm
by Scott Klement
Paul, the PUIUPLEXIT program is only used by ProfoundUI. So it's used for stuff like the file uploads widget, pui.capturePhoto(), and pui.uploadSignature(). However, a PHP upload would not use the PUIUPLEXIT program. (Unless it's somehow interfacing with ProfoundUI for this?)
The JSON you posted (specifically the 'key': 'prevented') will only occur if the exit program is called successfully, but returns a value side from 1 in the allow parameter.
If you would send us an e-mail at
support@profoundlogic.com, we can send you a fix to the error reporting bug as soon as it's available (hopefully later this afternoon) and then you can get a proper error message.
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 5:25 pm
by jac53
I have the same problem as Paul, so I am following his posting.
My PUIUPLEXIT has: Allow = 1 also, so I would appreciate it if the fix it is posted to the forum for the benefit of others like me.
Re: Signature/Camera image not uploading
Posted: Mon Nov 12, 2012 8:14 pm
by Scott Klement
I'll be sure to let you know, Jorge, when a fix is available.
Thanks!