Web Connection
plUpload function call
Gravatar is a globally recognized avatar based on your email address. plUpload function call
  Rod
  All
  Feb 26, 2017 @ 01:53pm

Hi, I've been using a simple implementation of plUpload to upload single image files, following the example in the Class plUploadHandler section in WWC 5.0 help almost exactly. So it is called by an HTML button:

my button:
<button id="btnUploadImage" ..."

the script:
// SIMPLE UPLOAD WITHOUT PRECONFIGURED UI USING BASE plUpload API
		    $(document).ready(function() {
		        var uploader = new plupload.Uploader({
		            // these two are required
		            browse_button: 'btnUploadImage', // you can pass in id...

etc.

I now need to execute some other functionalty (a record save from the html form) when the user clicks before I execute the plupload function to upload an image file. (i.e. change the button to a Submit button on the HTML form, retreive the values and save, THEN execute the plupload get/upload file function.) I've made a few attemps without luck. Can anyone give me a leg up on how to call the Java script programatically in my VFP code?

Thanks, Rod

Gravatar is a globally recognized avatar based on your email address. re: plUpload function call
  Harvey Mushman
  Rod
  Feb 27, 2017 @ 07:55am

As I recall (and I'm not using that code because my application is all AngularJS with WC RESTprocess backend), the actual upload button is an input type="file" under the covers.

In this case type=file behavior is the submit occurs when the user clicks to Open the selected file.

Assuming my memory is correct, you need to capture the form submit. Something like onsubmit='javascript:void();' on the form tag and then have a seperate routine attached to the click of a button that execuites the actual submit.

Since this is all client side stuff, you should be able to search the web for some sample code.

Another option might be to hide the file upload button until all of the user input fields are populated and validated. Then change the CSS for the file upload button from disabled thereby allowing the user to select a file.

Gravatar is a globally recognized avatar based on your email address. re: plUpload function call
  Michael Hogan (Ideate Hosting)
  Rod
  Mar 5, 2017 @ 04:07pm

In my app, the user has to 'Add Files' and then 'Start Upload' to push the files to a holding area on the server, and then when they do a 'Submit', my code grabs those files, moves them into the proper location, and associates them with the record.

Would that work for you, or are you looking for something different?

The key to my code is, when 'Start Upload' is done and I display the thumbnails, I also include hidden fields with each of those so that they are readable when submitted.

© 1996-2024