<input id="UserFile" size=50 type="file"
name="%%File.482571b10020b158.e1c9d0d2ceb6a5c5482571b50022e0ab.$Body.0.1F64">
@AttachmentNames will return all the attachment(s) filename of the document. To create anchor link to the file, a <ComputedValue> can be used to built the link.
temp := @AttachmentNames;
ahref := "<a title=\"" + temp +
"\" target=_blank href=" + DatabasePath +
"VUncat/" + @Text( @DocumentUniqueID ) +
"/$FILE/" + temp + ">" + temp + "</a>";
ahref
There is a problem when directly using the attachment name to be set as the anchor link. Files with space in the filename will produce broken link. Some file upload examples that I saw, include a message to inform user not to upload file with space in the filename. This is definitely not user friendly.
To overcome it use @URLEncode. It will handle the space or some other special characters in the filename.
ahref := "<a title=\"" + temp +
"\" target=_blank href=" + DatabasePath +
"VUncat/" + @Text( @DocumentUniqueID ) +
"/$FILE/" + @URLEncode("Domino"; temp) +
">" + temp + "</a>";
To add in additional function to removed the attachment, use an input checkbox with the name "%%Detach"
ahref := "<INPUT TYPE=checkbox NAME=\"%%Detach\" VALUE=\"" +
@URLEncode("Domino"; temp) + "\"> <a title=\"" +
temp + "\" target=_blank href=" + @WebDbName + "VUncat/" +
@Text( @DocumentUniqueID ) + "/$FILE/" + @URLEncode("Domino"; temp) +
">" + temp + "</a><br/>";
Checked on the filename that need to be removed. Then save document. The attachment will be removed.
Domino File Upload Control provides an easy way to upload file into the document. And the examples above is to access the attachments and manipulate it (open, delete).
Show-n-Tell Thursday Add to del.icio.us
9 comments:
This is a great tip and looks like just what I am after. All the steps worked fine until I actually clicked on the link The I got a "03/29/2007 04:16:10 PM HTTP Web Server: Unknown Command Exception [/07tm/targetm2007a.nsf/e75382212e7c5453852567ba000f4286/07tm/targetm2007a.nsf/VUncat/9AC00614058FB8F8862570C70003DB64/$FILE/batchelder.jpg]"
It looks like everything is working fine according to your to your post, but I must be missing something. Any suggestions greatly appreciated. I'm emailable at sme at bioedge.net if that is easier. In any case, thanks for a great description of the process.
OK, got it. you need a "/VUncat/ in the path and you need to make sure that your databasepath is actually pointing to the right path.Works great--adding the additions you suggested next. Thanks again
Thanks for the code. How do you suppress the v2attachments at the end of the form in a browser ?
I have tried $v2attachementoptions but with no luck and Jake of Codestore seemed to struggle too
Cheers,Sean
how to upload a video clip in lotus notes for other users to access it remotely? What should be the format, the size etc...
@shwela. There are many ways you can do it. You can attached the video onto a document for your user to download. A normal document with attachment can actually works.
@Sean, are you sure you're setting the field $V2AttachmentOptions to "0" rather than 0? Anyway another way to hide the V2 attachments is by placing the HTML tag noscript enclosed in brackets and standard HTML tag enclosing (i cannot write the tag here since it renders it as raw HTML and will not allow me to post) at the very last row of the form (rendered as passthrough HTML of course).
Thanks for this helpful post.
Two remarks:
If the document has no attachment, there will be still a checkbox displayed.
If the document has more than one attachments, every line except the first will be preceeded by a comma.
Both problems will be solved by displaying the html code this way:
@If(@Length(@AttachmentNames)>0;@Implode(ahref;"");"");
Thanks a lot.
Helpful in the assigment.
Post a Comment