File upload control on the web

Hi All,

I have a form in which I have 40 questions and each question has a file upload control associated with it. Now when a user sees a document with that form, all the files go down at the bottom which looks very ugly and confusing. Is there a way

a) So that I could have a link for each added file next to the question. or

b) Have all file links at the bottom but instead of the actual file name something like q1.doc, d2.doc, q3.doc and so on.

TIA,

Ki

Subject: file upload control on the web

I did this in 4.6 (2001) after that i hosted this example in my website http://www.dominodesigner.com

some reasons this website is down . If you send me ur email id i can send you screen shot.

my email id: cts_janardan@yahoo.com

Thanks

Subject: file upload control on the web

Try this:

  1. Put a hidden computed for display field on the form. Call it $V2AttachmentOptions and set it’s value to “0”

  2. Create a computed for display field on the form. Call it DisplayAttachments, say, and use something like this as the formula:

@If (@Attachments = 0; @Return(“”); “”);

ThisDb := @WebDbName;

res := @Implode(“<a href="/” + ThisDb + “/($vAllByUnid)/” +

@Text(@DocumentUniqueID) + “/$file/” + @AttachmentNames + “">” +

@AttachmentNames + “”;

“
”);

“[” + res + “]”

Tip: you might want to use rich text lite fields - one for storing the attachments and another for formatted text.

hth

Subject: RE: file upload control on the web

Hi,

Thanks for your reply. But this gives url with the attachment names. I dont want to do that. I want my own name instead of attachments name e.g. if the first attachment name is fileabc.doc, second is filexyz.doc, i want something like file1.doc, file2.doc and so on.

What I want is the question name to the url. So if the users have added files for question, 1,2,3, and 9 I want the links to be like

file1.doc, file2.doc, file3.doc and file9.doc and not the actual file names.doc.

Ki

Subject: RE: file upload control on the web

Use a seperate visible computed for display field for each question (e.g. DisplayAttachmentsQ1, DisplayAttachmentsQ2 etc.) and replace @AttachmentNames in the formula with @Subset ( @Subset ( @AttachmentNames ; n ) ; -1 ) where n is the question number.

If you want the attachments names to conform to a naming convention you’ll have to script a server agent that detaches then reattaches the files with the name you specify and then deletes the detached file from the file system.

Subject: RE: file upload control on the web

Hi Ian,

Thanks for your post. However I’m still not very clear. Can you please explain what exactly you mean with a couple of examples. Also keep in mind that we may have attachments for Q1,Q2 and Q9 only and no attachments for Q3-Q8. How would it work in that case?

Thanks alot for all your help,

Regards,

Ki

Subject: RE: file upload control on the web

Hi Tony,

The first part of my solution deals with the untidyness at the bottom of the page/document. If you spend a bit of time experimenting with that you’ll have gone a long way to solving what sounds like a largely cosmetic issue.

As for the server agent detaching files I think that may not be a viable solution now that you’ve further delineated the issue. Perhaps the users of your application can meet you half way and agree to provide files that conform to a naming convention you specify?

Subject: file upload control on the web–My Solution

For anybody trying to do something similar. I used some tips from here and some from codestore.org. Thank you everybody for their input and ideas especially Jake.

For each upload control, I gave it an id in the html attributes like FileAttachQ1

Then I have a computed field with the same formula and “type=hidden” in html attributes.

On save Im setting the value of my hidden field with the file path usign javascript.

document.forms[0].FileAttachmentQ2.value = document.forms[0].FileAttachQ2.value;

Then I have a computed text where I want to display the name of the file as a link. The formula for my computed text is:

dbName:=@ReplaceSubstring(@Subset(@DbName; -1); " “:”\“; “+”:”/");

x:=FileAttachmentQ2;

FileNameSpace:=@Trim(@Text(@RightBack(FileAttachmentQ2;“\”)));

FileName:=@ReplaceSubstring(FileNameSpace;" “;”+");

@If(x!=“”;“<A href =”+“/”+dbName+“/0/”+@Text(@DocumentUniqueID)+“/$FILE/”+@Text(FileName)+“>”+FileNameSpace+“”;“”)

And it is working like a charm!

hth,

Ki