Upload function

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Upload function

Post by Orin »

Hi Guys,

currently running profoundui 4.8.4.

I'm having a problem with the upload function using uploadSignature and the upload widget.

Whenever I try to upload the resulting message is "operation prevented by exit program."
However since upgrading a few months ago, from which version i do not recall, I have been experiencing this problem.

The strange thing is a program that had been writted a while back that used your upload widget works and gives no error. However since using the latest widget i continuously get the error. Not only that but when trying to upload a photo i get the same error.

Also the pui.uploadSignature option, using the snippet i copied from the documentation returns an alert "undefined" whenever i try to use the function upon calling the function with an onclick event of a button. I believe this is the error that is returned from the handler.

Please help. I am unsure as to why the uploading doesn't work except when using a program that is using an older upload widget. Also why is the function returning undefined.

thank you for the speedy reply.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Upload function

Post by Scott Klement »

That error means that the exit program is ending with Allow=0, which will force the upload to fail.

Is it possible that when you replaced Profound UI, you accidentally also replaced the exit program? If the exit program is missing, or if you use the default one rsupplied with Profound UI, then it will fail exactly as you have described.

Normally, when you update Profound UI, it replaces the source code in the PROFOUNDUI library (or whichever library youv'e chosen to install into) but it does not replace the *PGM object for the exit program if it exists. So, the idea is that after you've written your exit program, you'll save your source into your own library (not the PROFOUNDUI one) and compile the object into the PROFOUNDUI library, and you'll be all set to go.

But, if you deleted or recompiled that program from our source code, you'd have the problem you're describing.

Can you tell us more about your file upload exit program?
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: Upload function

Post by Orin »

Hi Scott,

I managed to get the capture photo function to work after recompiling our exit program and simply allowing all uploads.

However I'm having a problem with the signature widget when i'm using uploadsignature function, i get "undefined" alert.

Could you help explain why this is happening?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Upload function

Post by Scott Klement »

Can you post the code?
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: Upload function

Post by Orin »

here is the code. Note i have used the filename with and without the "fname" variable. Just to confirm that the variable wasn't the value that was undefined.
I'm assuming that the alert i'm getting shows the "response.error".


var fname = get("imgFNameID");

pui.uploadSignature({
"signaturePadId": "signaturepad1",
"dir": "/www/profoundui/htdocs/profoundui/XXXXXX/YYYYYYY",
"imageType": "image/jpg",
"fileName": fname,
"overwrite": true,
"handler": function(response) {
if (response.success) {
pui.click("sigPadConfirmID");
}
else {
alert(response.error);
}
}
});
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Upload function

Post by Scott Klement »

Ah, it looks like you have found a problem in our documentation. I'm referring to this page of the documentation:
http://www.profoundlogic.com/docs/displ ... config+%29

The secton named "Configuration Options" correctly explains the parameters to the handler. It states that the handler will receive two parameters:
  • success - true or false value indicating whether the photo was captured and uploaded successfully
  • error - error message; present only if success is false
However, the problem is the example. The example only receives one parameter rather than the two described above. It expects that parameter to be an object with subfields for 'success' and 'error', which is not how it works.

I have now updated the documentation. The corrected example looks like this:

Code: Select all

pui.uploadSignature({
  "signaturePadId": "SignaturePad1",
  "dir": "/www/profoundui/htdocs/signatures",
  "imageType": "image/jpeg",
  "fileName": "driverSignature.jpg",
  "overwrite": true,
  "handler": function(success, errorMsg) {  <--- two parameters, one for success flag, one for the error message
    if (success) {
      pui.click();
    }
    else {
      alert(errorMsg);
    }
  }
});
You should update your code the same way, so your example will look like this:

Code: Select all

  var fname = get("imgFNameID");

  pui.uploadSignature({
    "signaturePadId": "signaturepad1",
    "dir": "/www/profoundui/htdocs/profoundui/XXXXXX/YYYYYYY",
    "imageType": "image/jpg",
    "fileName": fname,
    "overwrite": true,
    "handler": function(success, errorMsg) {
      if (success) {
        pui.click("sigPadConfirmID");
      }
      else {
        alert(errorMsg);
      }
    }
  });
Hope that helps
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: Upload function

Post by Orin »

Hi Scott,

Thanks for the response.

I implemented the change and it worked. Thank you.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests