Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CASE-OPENED] File Upload Via Maintain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CASE-OPENED] File Upload Via Maintain
 Login/Join
 
Member
posted
Hi,

How can a user upload a pdf file, from his/her Windows PC to a Unix WebFOCUS Reporting Server, using a maintain program?

The user needs to browse for the pdf file on his/her Windows PC local drive and then select it. After that, he/she clicks on a button that uploads it to the Unix WebFOCUS Reporting Server.

Thank you for your time!

This message has been edited. Last edited by: M. Nagy,


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Master
posted Hide Post
This really is outside of Maintain's abilities. Remember, Maintain's purpose is to update databases.

You can accomplish this with a JSP procedure that can be kicked off from Maintain. Do a google search for a procedure (JSP) to do this. You should then be able to use JavaScript from inside the Maintain procedure to make it work.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Member
posted Hide Post
Thank you Mark for your reply.
I will try out your solution and post here again.


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Member
posted Hide Post
Hi,
I tried your solution but I am stuck.
Here is what I did in details.
1- Created an HTML object on the form of the maintain file. The following is its content:
<form action="http://192.168.200.210:8080/approot/moataz_mro/fileupload.jsp" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />
</form>

2- Created fileupload.jsp and it is as follows:
<%@ page import="java.io.*,java.util.*, javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="org.apache.commons.fileupload.*" %>
<%@ page import="org.apache.commons.fileupload.disk.*" %>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory.*" %>
<%@ page import="org.apache.commons.fileupload.servlet.*" %>
<%@ page import="org.apache.commons.io.output.*" %>

<%
   File file ;
   int maxFileSize = 5000 * 1024;
   int maxMemSize = 5000 * 1024;
   String filePath = "/pas/WF/apps/moataz_mro/";

   String contentType = request.getContentType();
   if ((contentType.indexOf("multipart/form-data") >= 0)) {

      DiskFileItemFactory factory = new DiskFileItemFactory();
      factory.setSizeThreshold(maxMemSize);
      factory.setRepository(new File("/tmp"));
      ServletFileUpload upload = new ServletFileUpload(factory);
      upload.setSizeMax( maxFileSize );
      try{
         List fileItems = upload.parseRequest(request);
         Iterator i = fileItems.iterator();
         out.println("<html>");
         out.println("<body>");
         while ( i.hasNext () )
         {
            FileItem fi = (FileItem)i.next();
            if ( !fi.isFormField () )  {
                String fieldName = fi.getFieldName();
                String fileName = fi.getName();
                boolean isInMemory = fi.isInMemory();
                long sizeInBytes = fi.getSize();
                file = new File( filePath + "yourFileName") ;
                fi.write( file ) ;
                out.println("Uploaded Filename: " + filePath + fileName + "<br>");
            }
         }
         out.println("</body>");
         out.println("</html>");
      }catch(Exception ex) {
         System.out.println(ex);
      }
   }else{
      out.println("<html>");
      out.println("<body>");
      out.println("<p>No file uploaded</p>");
      out.println("</body>");
      out.println("</html>");
   }
%>

3- Added the jar file commons-fileupload.jar and its dependency commons-io.jar under /usr/local/tomcat/apache-tomcat-8.0.3/webapps/ibi_apps/WEB-INF/lib
4- Tried it out as follows:
I ran the maintain file. Browsed a text file. Clicked upload file and then nothing happened.
How can I trace if an error occurred?
Also, did I add the jar files correctly? Because I think the problem is that the jars are not found by the jsp file.
Any help is much appreciated.


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Member
posted Hide Post
Hi,

Any help is much appreciated.

Thanks and best regards,
M. Nagy


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Member
posted Hide Post
quote:
Originally posted by M. Nagy:
Hi,

How can a user upload a pdf file, from his/her Windows PC to a Unix WebFOCUS Reporting Server, using a maintain program?

The user needs to browse for the pdf file on his/her Windows PC local drive and then select it. After that, he/she clicks on a button that uploads it to the Unix WebFOCUS Reporting Server.

Thank you for your time!



Hi,

Any help is much appreciated.

Thanks and best regards,
M. Nagy


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Member
posted Hide Post
quote:
Originally posted by M. Nagy:
quote:
Originally posted by M. Nagy:
Hi,

How can a user upload a pdf file, from his/her Windows PC to a Unix WebFOCUS Reporting Server, using a maintain program?

The user needs to browse for the pdf file on his/her Windows PC local drive and then select it. After that, he/she clicks on a button that uploads it to the Unix WebFOCUS Reporting Server.

Thank you for your time!



Hi,

Any help is much appreciated.

Thanks and best regards,
M. Nagy


Any Suggestion?


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
Master
posted Hide Post
Please make sure that Customer Support has your most current repro and we will try to debug it here.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Member
posted Hide Post
Hi Mark,

The Customer Support has asked me to post the question here as it is out of their scope.

Best regards,
M. Nagy


WebFOCUS 8.1.05M
AIX 7.1, All Outputs
 
Posts: 12 | Registered: October 31, 2017Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CASE-OPENED] File Upload Via Maintain

Copyright © 1996-2020 Information Builders