Custom File Upload Controls

Hi

Has anyone created / used a custom file upload control? I would like to use something like FancyUpload with MooTools, but I’m struggling to make it work. I’m not even sure if it’s possible as I can’t find any evidence of it running on Domino anywhere!

(link: http://digitarald.de/project/fancyupload/)

Could anyone point me to a good example to use?

My preference would be free (as ever!) and that it is platform/browser independant - like the FancyUpload example

Any thoughts greatly appreciated,

Paul.

Subject: I’ve used SWFUpload. The trick is avoiding “File Upload Not Allowed Exception”

I used SWFUpload.org’s code.

It was a bit of JavaScript, and it’s impossible if you don’t know that Domino by default doesn’t allow submitted fields that aren’t on the receiving form, and since a File Upload Control actually has a field name behind the scenes, like “%%File.uglyuglyuglyugly12345”, most people miss it completely and end up getting errors in their log that look like

HTTP Web Server: File Upload Not Allowed Exception

The field checking is a good thing. You can disable it with an Notes.ini setting of DominoDisableFileUploadChecks=1 but that has security implications across your server. Instead put a ‘real’ file upload control in with an ID of FileUploadControl, then passed that ugly “field name” to SWFUpload with

swfuploadsettings.file_post_name = document.getElementById(‘FileUploadControl’).name

The nice thing about sending a native file upload to the browser is that you can control it within a div tag or some other element and then replace the contents, creating a web page that degrades gracefully… i.e. if your file upload control fails to initialize for whatever reason, the user still has a file upload control.

Subject: Got it!

Finally I was able to make this work using basic URL commands.

One last thing - has anyone used this on the same form? The documents I’m uploading to are already created, and if you use the ?SaveDocument url command as the upload url, saving the document creates a replication conflict.

I’ve gotten around this by using a second form to upload to the document, but I’d be interested to know if there’s a better way??

Thanks as ever,

Paul.

Subject: Results?

Hi Paul. I just started researching this topic yesterday, and needless to say, it’s a doozie. I don’t suppose you’d be willing to post/share a demo to the Sandbox, etc.? Many thanks in advance.

  • Brent

Subject: re results

Hi Bret

Sorry - didn’t notice your reply. What I’ve got working is all wrapped up in an app, but I’m more than happy to share it as best I can. Drop me a note via pgaler at channel-advantage dot co dot uk and we’ll catch up. If something good comes out of it, we’ll post it to the sandbox :slight_smile:

Kindest Regards,

Paul.

Subject: Not quite there yet…

Hi John

Thanks for your response, really appreciate it.

I’ve downloaded SWFupload and have been trying since seeing your post to get it to function but I’m not quite there yet.

So far I think I’ve covered the basics…

Script in the header

Code in the onload event of the form

Named the upload control as you suggested

However it won’t load as flash - only old style.

The code I’ve put in the onload event for the window is:

var swfu;

window.onload = function () {

var settings_object = {

	upload_url : "http://localhost/swf_upload.nsf/test_form?OpenForm",

	flash_url : "http://localhost/swf_upload.nsf/swfupload.swf",

	file_post_name : document.getElementById('FileUploadControl').name,

	file_size_limit : "20 MB"

};



swfu = new SWFUpload(settings_object);

};

Does this seem about right?

Thanks again,

Paul.

Subject: Got a little further

I’ve gotten a little further now, using an example I found here:http://demo.swfupload.org/v220/simpledemo/index.php

My version works in that it allows me to select a file and returns the message “1 file uploaded” but no document is saved and therefore nothing is uploaded.

I’m not sure what’s not right, but I wondered if it was the upload_url parameter… to match the post element of the document it would be:

/SWF_Upload.nsf/Test_Form?OpenForm&Seq=1

which is what I’ve used - but not gotten anywhere. Obviously this will also change for a saved document.

Does anyone have any other suggestions?

Thanks in advance,

Paul.

Subject: Any Luck?

Did you have any luck trying to get this to work? I’ve been wanting to get SWFUpload to work with Domino for years.