Home
TeamSite
Making Image Upload Easier
System
Hi All,
I have in my datacapture form - BROWSER element for image selection.
For selecting image to be displayed in web page - user has to select the image path from teamsite server using this browse button.
While creating the new contents - the users normally do not have the image already uploaded on the server.
My users find the process of uploading the image from their local machine to teamsite server a difficult one.
So, I am looking for an alternative wherein users can directly use a browse button to view the contents on local machine. And upon selection, templating automatically uploads the image on the teamsite server.
It is also desirable if the image can be previewed while browsing on local machine.
Please let me know what is the best way to do this.
Thanks,
Ravindra
Find more posts tagged with
Comments
Gregg Faus
I wrote a JSP app to do single file uploads within a data capture form. The DCT uses a browser item and a cgi-callout. An example of this code is listed below:
<item name="file">
<label>File</label>
<description>&nbsp;Click Browse to choose a PDF or Word document within TeamSite, or click Upload to select one from your PC.</description>
<browser required="t" maxlength="255" size="25" extns=".pdf,.doc" ceiling-dir="/templatedata/upload/files/News_Library/">
<cgi-callout url="/iw/custom/templating/single_file_upload/index.jsp?upload_directory=/templatedata/upload/files/News_Library/&valid_extensions=pdf,doc" label="New File" window-features="width=400,height=144,resizable=no,status=yes,toolbar=no,scrollbars=yes"/>
</browser>
</item>
Including the callout is the easy part. What is difficult is to install the JSP app to allow the uploading. The app utilizes a free 3rd party component for uploading called JSP Smart Upload (
http://www.jspsmart.com/
). You'll have to follow directions on their website to get it installed.
Once installed you'll also need to make the JSP page available from TeamSite. I will detail these instructions if need be.
I've attached the 3 files necessary. Two are application files while the other is a stylesheet (I placed it in /iw-home/httpd/iw/styles).
Good luck.
- gf
MattP
As well, I think the visual format toolbar allows ftp uploads from the clients local machine. There is some configuration involved.
Matt
Migrateduser
As you predicted, I am having trouble installing the JSP app into the TeamSite environment. Do you have detailed instructions on how to do that? The instructions on JspSmart's Web site don't seem compatible with the TeamSite setup.
Gregg Faus
Here is what I did to add this to the TeamSite environment:
*** DO THIS AT YOUR OWN RISK. YOUR ENVIRONMENT MAY BE DIFFERENT ***
1) Open the file servlet.xml in \iw-home\servletd\conf\ and add the following line in the <!-- BEGIN INTERWOVEN WEBAPPS --> section:
<Context path="/iw/custom" docBase="../httpd/webapps/custom" crossContext="false" debug="0" reloadable="false" trusted="false"/>
Here is the complete section:
<!-- BEGIN INTERWOVEN WEBAPPS -->
<Context path="/iw/webdesk" docBase="../httpd/webapps/webdesk" crossContext="false" debug="0" reloadable="false" trusted="false"/>
<Context path="/iw/tsadmin" docBase="../httpd/webapps/tsadmin" crossContext="false" debug="0" reloadable="false" trusted="false"/>
<Context path="/iw/eventsubsystem" docBase="../httpd/webapps/eventsubsystem" crossContext="false" debug="0" reloadable="false" trusted="false"/>
<Context path="/iw/ddui" docBase="C:/PROGRA~1/INTERW~1/DATADE~1/httpd/webapps/ddui" crossContext="false" debug="0" reloadable="false" trusted="false"/>
<Context path="/iw/custom" docBase="../httpd/webapps/custom" crossContext="false" debug="0" reloadable="false" trusted="false"/>
<!-- END INTERWOVEN WEBAPPS -->
2) Open http.conf.template file in \iw-home\iw-webd\conf\. Add a new alias to the "Alias Module" (#<IfModule mod_alias.c>):
Alias /iw/custom/ "__IW_TS_HOME__/httpd/webapps/custom/"
3)Open rewrite.conf.template file in \iw-home\iw-webd\conf\. Modify the rewrite condition (line 51 for me):
RewriteCond %{REQUEST_URI} ^/iw/(webdesk|tsadmin)(/.*)?$
to
RewriteCond %{REQUEST_URI} ^/iw/(webdesk|tsadmin|custom)(/.*)?$
Notice the addition of the "custom" directory.
4) Create a custom directory similar to the graphic that I've attached. I would copy an existing app (e.g. tsadmin) directory and delete everything but the WEB-INF directory.
5) Then copy the JSP Smart files to the class\com directory.
6) Restart the TS services.
I can provide additional info if you need. Basically the problem is configuring Tomcat correctly and having Apache recognize your new custom application directory. You don't have to add a custom app directory but I did since I knew I'd be adding more Java functionality in the future.
I'm just a novice with this stuff but found this document to be useful:
http://scitec.uwichill.edu.bb/cmp/online/CS36L/tutorials/TomcatIntroduction/TomcatIntroDevApp.html
Good luck!
Migrateduser
Your instructions were perfect. Thank you very much.
syim
I followed the instructions to install the jsp smart upload, set up the custom webapp directory, and restart TS server. When I click on the "New File" button from the template, I got a HTTP 404 error instead. Any idea what could be the cause of the error?
I notice the form action in "index.jsp" is "index.jsp", should this be "/iw/custom/templating/single_file_upload/index.jsp"?
Thanks
syim
Looks like the problem was my TeamSite server does not recognize the custom webapp. If I install the smart upload app in an existing webapp, the upload jsp works.
My TS is in Windows platform. Any idea, what could be the cause that my custom webapp cannot be recognized? I have modified all those config files as instructed. I have restarted TS server as well. Do I need to reboot my host?
Gregg Faus
To answer your previous question about the form handler... no, if the handler is set to index.jsp it will look for the resource (index.jsp) in the current directory.
Glad to see that you got it work at least w/o the custom web app directory. I would venture to say that it is a mod rewrite problem. Because if your custom directory was being handled correctly, you wouldn't see the 404.
Did you run a "iwreset -a" after modifying the file rewrite.conf.template?
syim
After running "iwreset -a", the custom webapp works!! Thanks a lot.
Gregg Faus
Good deal.
aces
Does this method allows upload to any directory on the server and multiple files?
Gregg Faus
It can be configured to upload anywhere that is writable on the server. Multiple file uploads are not supported. You'd need AppletFile or some other similar functionality for that. It wasn't needed in my case.
aces
What changes is there to upload to any directory on the server?
Edited by aces on 07/22/03 01:18 PM (server time).
Gregg Faus
To change the upload drive you must edit the line in the file "library.jsp":
static final String UPLOAD_DRIVE = "Y:";
The path information is actually built from two separate variables that are passed in: area_path and upload_directory. So I guess you'd either need to change the values of these two preset values to whatever location you want (in datacapture.cfg). Or you could change the behavior of the following line in the "index.jsp" file:
uploadDirectory = mySmartUpload.getRequest().getParameter("upload_directory");
validExtensions = mySmartUpload.getRequest().getParameter("valid_extensions");
Hope that helps.
Migrateduser
Hi,
Is there any solution based on CGI?
Instead of using JSP can I use CGI-perl to upload a local file to TeamSite server?
Any help will be greatly appreciated.
Thanks
-Ashish
Migrateduser
This thread is seeing a lot of activity, I wanted to let people know that making these changes to the IWOV webapp is an unsupported activity. Each time you upgrade or install a patch, you will need to make these changes again. The IWOV installer does not respect these changes, since it's unsupported. Future releases of TeamSite will handle this capability more gracefully.
Please be advised that you are taking on this responsibility by making these types of changes.
lissa
vvs
Hi,
We are planning to implement the same functionality. Please
can you share the Code with us.
Regards
VVS
tsrookie
Hi Ashish, anyone!
We are also looking for a Perl solution, we have found using cgi_wrapper doesn't work.
Cheers
Colin
Valentine
https://support.interwoven.com/kb/kb_show_article2.asp?ArticleID=52656
Adam Stoller
Interesting - at the top of the article it says: "This article contributed by a DevNet community user" - yet the article doesn't seem to appear *on* DevNet.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
lhdavis
If you look up the number
52656
under Tech Library it's there. Guess people should use the DevNet link versus the Support site link.
Luke Davis
Open Technology Group, Inc.
luke.davis@med.va.gov
Adam Stoller
Hmm - interesting - I tried that and this is what I got back in return:
Results for: 52656
No results were found for your search.
Try changing some of the words in your query.
Yet clearly, you were able to find it on DevNet... If I were Smitty I could understand this not working just for me ;-)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
tsrookie
Hi all,
Thank you for your contributions
Ok we tried the solution in tech note 52656 and the script need to be have the appropriate permissions to write to the file server and found it didn't work,
another thread told us to run it using iw_cgi_wrapper and found per knowledge base article 49735
https://support.interwoven.com/kb/kb_show_article2.asp?ArticleID=49735
on the support site that iw_cgi_wrapper does not support multi-part form type, so we are back to square one, we either try implementing the jsp solution mentioned in this thread or keep looking for a perl solution. Maybe Johnny will share with us the Perl solution he mentioned in yet another thread relating to this matter.
Colin Johnstone
Independent Teamsite Analyst Programmer
Westfield Corporation
Australia
nipper
The upload perms may be due to the use iwui not having write access to the workarea.
Can you add iwui to the group that owns the WA ?
We had to do that here.
ANdy