File Upload - File Name in Hebrew problem

Hi all,
I am using file upload with IWDResource in NW04s and while loading files with hebrew encoding I am getting gibrish when using
getResourceName()
method.
I also tried working with data and fileName properties - both giving null.
Any ideas?
Thanks,
Aviad

Hi Levy,
Use this code in action button for upload a file
Here up is a context attribute of type "com.sap.ide.webdynpro.uielementdefinitions.Resource"
It is to be bind with upload UI element property called "resource"
InputStream text = null;
int temp = 0;
try
File file = new File(wdContext.currentContextElement().getUp().getResourceName());
FileOutputStream op = new FileOutputStream(file);
if(wdContext.currentContextElement().getUp()!=null)
text = wdContext.currentContextElement().getUp().read(false);
while((temp=text.read())!=-1)
op.write(temp);
op.flush();
op.close();
String path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
catch(Exception e)
e.printStackTrace();

Similar Messages

  • File upload using apache Commons FileUpload problem

    Hi All,
    I have used Commons FileUpload for uploading files from windows to unix machine. I'm able to upload files but I have a problem about the contents of file copied in unix. When i upload files few files containing special characters are not copied correctly in unix instead ascii codes are getting copied/written. Seems to be a problem with character encoding.
    For example symbol "�" is not getting copied correctly in unix. So as new line character to. If anyone has faced such issues kindly provide few pointers on this. Appreciate your guidance.
    Thanks,
    -Aj

    Thanks for the reply.
    I'm using the Commons FileUpload class "FileItem" which holds the filestream data and using function
    code snippet of file upload
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    Iterator it = fileItemsList.iterator();
    while (it.hasNext())
         FileItem fileItemTemp = (FileItem)it.next();
         File saveToFile = new File("newFile");
          fileItem.write(saveToFile ); // write fileItem data to saveToFile.
    } FileItem object takes care of writing data to disk.No idea,how it does internally.
    Thanks,
    -Aj.

  • File uploading file through RFC

    Hi All ,
    I am trying to upload file using FM GUI_Upload ,its working fine when i run in sap , But throws a Dump if the  file path is passed from .net . The same file path when i pass it in sap directly it works fine .
    the error :
    OBJECTS_OBJREF_NOT_ASSIGNED in FM DP_CONTROL_ASSIGN_TABLE
    Any Help will be great .
    Thanks
    Vinay

    Hi use this
    reward if help
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = FILENAME
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = BUFFER
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22

  • File Upload File Renaming

    I was wondering if anyone knows how to set up a trigger to automatically rename a file on upload to change spaces into underscores using DToolbox image and resize feature. An example is from "My picture.jpg" to "My_picture.jpg". I also wonder if this could be part of a form validation? Maybe using a spry widget?
    I have no experience with triggers, and especially the adobe tng.FileUpload.class.php file (which I assume is where to change the trigger? or maybe it's in the tng.ImageUpload.class.php file?)
    Thanks for the help!
    -Chris

    Hi Chris,
    fotunately I already made such a modification to ADDT´s predecessor "MX Kollection", and as the core files didn´t change, it will assumingly work the same:
    1. add the following function to the file "includes/common/KT_functions.inc.php":
    replace all chars from uploaded filenames other than alpha-numeric and "_" and "-" and "." with an underscore (_)
    function KT_websafe_filename($text) {
    return preg_replace("/[^a-zA-Z0-9\-_\.]+/", "_", $text);
    2. change line 120 in file "includes/common/lib/file_upload/KT_FileUpload.class.php":
    old: $fileName = KT_replaceSpecialChars($fileName, 'filter');
    new: $fileName = KT_websafe_filename($fileName, 'filter');
    This modification will of course *always* be renaming the uploaded file accordingly -- but you´ll need no fancy trigger and anything else.
    Please backup the 2 original files !!
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Problem with file upload: File to big...

    Hi,
    when I try to upload a file of 6MB I get an error that the file is to big. I changed the web.xml but maybe I forgot something?
    I use Jdeveloper 11.1.1.2.0
    This is in my web.xml:
    <context-param>
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
    <param-value>51200000</param-value>
    </context-param>
    <context-param>
    <!-- Maximum disk space per request (in bytes) - Uploadfiles larger than this will force an Exception -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
    <!-- Use 500M -->
    <param-value>512000000</param-value>
    </context-param>  The total web.xml:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <context-param>
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
    <param-value>51200000</param-value>
    </context-param>
    <context-param>
    <!-- Maximum disk space per request (in bytes) - Uploadfiles larger than this will force an Exception -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
    <!-- Use 500M -->
    <param-value>512000000</param-value>
    </context-param>        
      <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
      </context-param>
      <context-param>
        <description>If this parameter is true, there will be an automatic check of the modification date of your JSPs, and saved state will be discarded when JSP's change. It will also automatically check if your skinning css files have changed without you having to restart the server. This makes development easier, but adds overhead. For this reason this parameter should be set to false when your application is deployed.</description>
        <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>
        <description>Whether the 'Generated by...' comment at the bottom of ADF Faces HTML pages should contain version number information.</description>
        <param-name>oracle.adf.view.rich.versionString.HIDDEN</param-name>
        <param-value>false</param-value>
      </context-param>
      <filter>
        <filter-name>JpsFilter</filter-name>
        <filter-class>oracle.security.jps.ee.http.JpsFilter</filter-class>
        <init-param>
          <param-name>enable.anonymous</param-name>
          <param-value>true</param-value>
        </init-param>
        <init-param>
          <param-name>remove.anonymous.role</param-name>
          <param-value>false</param-value>
        </init-param>
      </filter>
      <filter>
        <filter-name>trinidad</filter-name>
        <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
      </filter>
      <filter>
        <filter-name>ADFLibraryFilter</filter-name>
        <filter-class>oracle.adf.library.webapp.LibraryFilter</filter-class>
      </filter>
      <filter>
        <filter-name>adfBindings</filter-name>
        <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>JpsFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
      <filter-mapping>
        <filter-name>trinidad</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>
      <filter-mapping>
        <filter-name>ADFLibraryFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>
      <filter-mapping>
        <filter-name>adfBindings</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>
      <filter-mapping>
        <filter-name>adfBindings</filter-name>
        <servlet-name>adfAuthentication</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>
      <listener>
        <listener-class>oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack</listener-class>
      </listener>
      <listener>
        <listener-class>oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack</listener-class>
      </listener>
      <listener>
        <listener-class>oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack</listener-class>
      </listener>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet>
        <servlet-name>resources</servlet-name>
        <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>BIGRAPHSERVLET</servlet-name>
        <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.graph.GraphServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>BIGAUGESERVLET</servlet-name>
        <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.gauge.GaugeServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>MapProxyServlet</servlet-name>
        <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.geoMap.servlet.MapProxyServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>GatewayServlet</servlet-name>
        <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.graph.FlashBridgeServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>adflibResources</servlet-name>
        <servlet-class>oracle.adf.library.webapp.ResourceServlet</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>adfAuthentication</servlet-name>
        <servlet-class>oracle.adf.share.security.authentication.AuthenticationServlet</servlet-class>
        <init-param>
          <param-name>success_url</param-name>
          <param-value>/pages/Tickets.jspx </param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>resources</servlet-name>
        <url-pattern>/adf/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>resources</servlet-name>
        <url-pattern>/afr/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>BIGRAPHSERVLET</servlet-name>
        <url-pattern>/servlet/GraphServlet/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>BIGAUGESERVLET</servlet-name>
        <url-pattern>/servlet/GaugeServlet/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>MapProxyServlet</servlet-name>
        <url-pattern>/mapproxy/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>resources</servlet-name>
        <url-pattern>/bi/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>GatewayServlet</servlet-name>
        <url-pattern>/flashbridge/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>adflibResources</servlet-name>
        <url-pattern>/adflib/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>adfAuthentication</servlet-name>
        <url-pattern>/adfAuthentication</url-pattern>
      </servlet-mapping>
      <security-constraint>
        <web-resource-collection>
          <web-resource-name>adfAuthentication</web-resource-name>
          <url-pattern>/adfAuthentication</url-pattern>
        </web-resource-collection>
        <auth-constraint>
          <role-name>valid-users</role-name>
        </auth-constraint>
      </security-constraint>
      <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
          <form-login-page>/faces/LoginPage.jspx</form-login-page>
          <form-error-page>/error.html</form-error-page>
        </form-login-config>
      </login-config>
      <security-role>
        <role-name>valid-users</role-name>
      </security-role>
    </web-app>

    Hi,
    It works for me, the only difference is I am using parameters from trinidad's packages
        <context-param>
            <!-- Maximum memory per request (in bytes) -->
            <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
            <!-- Use 500K -->
            <param-value>512000</param-value>
        </context-param>
        <context-param>
            <!-- Maximum disk space per request (in bytes) -->
            <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
            <!-- Use 5,000K -->
            <param-value>5120000</param-value>
        </context-param>Try it, maybe it will work.
    Pedja

  • Macos file upload file browse has started suddenly to close after a few seconds before allowing me to choose a file

    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9
    A couple of days ago after the latest update every time I try and upload a file to a web site the file browse has started suddenly to close after a few seconds before allowing me to choose a file.

    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9
    A couple of days ago after the latest update every time I try and upload a file to a web site the file browse has started suddenly to close after a few seconds before allowing me to choose a file.

  • Fileaccess.httpUploadBean doesn't upload file in Jdevelper 9.0.3

    Hi,
    I am using Jdevelper 9.0.3 to develop a jsp Based File Upload Utility.
    I have attached Liberary "JSP RUNTIME" which reffers to "ojsp.jar","ojsputil.jar","oc4j.jar","servlet.jar","ojc.jar".
    while running the code for file upload, file doesn't get uploaded. I am not getting any exceptions too.
    But the same pease of code with same liberary "JSP RUNTIME" is working absolutly fine(Uploading File), when i am running it using Jdeveloper10.1.2, and This is Strange to me.Actualy i need to use Jdeveloper9.0.3 only.Please let me know if any patch is required to apply in Jdeveloper9.0.3.
    Please find the code below and help.
    fileaccess.properties
    fileaccess.basedir = C:/
    fileUpload.jsp
    <html><body>
    <form name = "formname" action="beanUploadExample.jsp" method=POST ENCTYPE="multipart/form-data" />
    <br>MailID: <INPUT TYPE="text" NAME="strMailId" />
    <br> File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
    <br><INPUT TYPE="Submit" NAME="Submit" VALUE="Send" >
    <INPUT type="reset" name="reset" value = "Cancel">
    </form>
    </body></html>
    beanUploadExample.jsp
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page language="java"
    import="java.util.*,java.io.*, oracle.jsp.webutil.fileaccess.*" %>
    <html><body>
    <SCRIPT language="JavaScript">
    function formAction()
    if (document.upForm.forward.value == "true")
    {//tOMORROW PASS THE FILE NAME WITH ACTION PARAM
    //alert("Submit");
    document.upForm.action = "uploadco"
    document.upForm.submit();
    </SCRIPT>
    <Form name="upForm" method ="post" > <!--action ="beanUploadExample.jsp" >-->
    <%
    String userdir = "Test";
    String strFlag = "";
    String strFileName ="";
    String strDirName ="";
    String strAbsoluteName ="";
    %>
    <jsp:useBean id="upbean"
    class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
    <jsp:setProperty name="upbean" property="destination" value="<%=userdir%"/>
    </jsp:useBean>
    <%
    try{
    upbean.setBaseDir(application, request);
    String str = upbean.getDestination();
    // application.getServletContextName();
    //out.println("The Servlet Context is "+strContext) ;
    out.println("The value of Destination is "+str) ;
    upbean.upload(request);
    String name = upbean.getParameter("strMailId");
    out.println("name-----:::::: "+name) ;
    String strDestType = upbean.getDestinationType();
    out.println("strDestType-----:::::: "+strDestType) ;
    Enumeration fileNames = upbean.getFileNames();
    while (fileNames.hasMoreElements()) {
    strFlag = "true";
    strFileName = (String)fileNames.nextElement();
    out.println("strFileName File Name Is:::::"+strFileName);
    strAbsoluteName = strFileName.substring(4,strFileName.length());
    catch(IOException ex)
    out.println("IOException is =="+ex.toString());
    catch(Exception ex)
    out.println("IOException is =="+ex.toString());
    %>
    <table width = 50% align="center" >
    <tr>
    <td align ="center"><input type = "Button" name ="Submit" value="Ok" onclick="formAction()" ></td></tr></table>
    </Form>
    </body></html>

    Hi,
    I am using Jdevelper 9.0.3 to develop a jsp Based File Upload Utility.
    I have attached Liberary "JSP RUNTIME" which reffers to "ojsp.jar","ojsputil.jar","oc4j.jar","servlet.jar","ojc.jar".
    while running the code for file upload, file doesn't get uploaded. I am not getting any exceptions too.
    But the same pease of code with same liberary "JSP RUNTIME" is working absolutly fine(Uploading File), when i am running it using Jdeveloper10.1.2, and This is Strange to me.Actualy i need to use Jdeveloper9.0.3 only.Please let me know if any patch is required to apply in Jdeveloper9.0.3.
    Please find the code below and help.
    fileaccess.properties
    fileaccess.basedir = C:/
    fileUpload.jsp
    <html><body>
    <form name = "formname" action="beanUploadExample.jsp" method=POST ENCTYPE="multipart/form-data" />
    <br>MailID: <INPUT TYPE="text" NAME="strMailId" />
    <br> File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
    <br><INPUT TYPE="Submit" NAME="Submit" VALUE="Send" >
    <INPUT type="reset" name="reset" value = "Cancel">
    </form>
    </body></html>
    beanUploadExample.jsp
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page language="java"
    import="java.util.*,java.io.*, oracle.jsp.webutil.fileaccess.*" %>
    <html><body>
    <SCRIPT language="JavaScript">
    function formAction()
    if (document.upForm.forward.value == "true")
    {//tOMORROW PASS THE FILE NAME WITH ACTION PARAM
    //alert("Submit");
    document.upForm.action = "uploadco"
    document.upForm.submit();
    </SCRIPT>
    <Form name="upForm" method ="post" > <!--action ="beanUploadExample.jsp" >-->
    <%
    String userdir = "Test";
    String strFlag = "";
    String strFileName ="";
    String strDirName ="";
    String strAbsoluteName ="";
    %>
    <jsp:useBean id="upbean"
    class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
    <jsp:setProperty name="upbean" property="destination" value="<%=userdir%"/>
    </jsp:useBean>
    <%
    try{
    upbean.setBaseDir(application, request);
    String str = upbean.getDestination();
    // application.getServletContextName();
    //out.println("The Servlet Context is "+strContext) ;
    out.println("The value of Destination is "+str) ;
    upbean.upload(request);
    String name = upbean.getParameter("strMailId");
    out.println("name-----:::::: "+name) ;
    String strDestType = upbean.getDestinationType();
    out.println("strDestType-----:::::: "+strDestType) ;
    Enumeration fileNames = upbean.getFileNames();
    while (fileNames.hasMoreElements()) {
    strFlag = "true";
    strFileName = (String)fileNames.nextElement();
    out.println("strFileName File Name Is:::::"+strFileName);
    strAbsoluteName = strFileName.substring(4,strFileName.length());
    catch(IOException ex)
    out.println("IOException is =="+ex.toString());
    catch(Exception ex)
    out.println("IOException is =="+ex.toString());
    %>
    <table width = 50% align="center" >
    <tr>
    <td align ="center"><input type = "Button" name ="Submit" value="Ok" onclick="formAction()" ></td></tr></table>
    </Form>
    </body></html>

  • Unable to upload Files to child site collection using REST

    Dear All,
    I referred this article http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx for uploading documents to SP Document Library and it works fine for any document library under the root site collection(
    for example "http://<server name>/Shared Documents" but when i upload the same document to one of the sub site collection created using Managed Path( the site collection path is "http://<server name>/files/Case" and the library
    name is "records") it fails and i get below error:
    The security validation for this page is invalid. Click Back in your
    Web browser, refresh the page, and try your operation again, Error Code -2130575251 Microsoft.SharePoint.SPException"
    Any help suggestion to resolve this? I've almost tried everything to resolve this issue but no luck.. appreciate any help
    for this..
    Regards,
    Vishal

    Hi,
    According to your post, my understanding is that you had an issue uploading files to subsite using REST.
    I had made a simple code demo below, it will upload a file to Document Library after you make your selection with the File control.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function uploadFile(){
    //alert(2);
    if (document.getElementById("file").files.length === 0) {
    alert('No file was selected');
    return;
    var parts = document.getElementById("file").value.split("\\");
    var filename = parts[parts.length - 1];
    var file = document.getElementById("file").files[0];
    uploadFileSync("http://YourSite", "Documents", filename, file);
    //Upload file synchronously
    function uploadFileSync(spWebUrl , library, filename, file)
    //alert(3);
    var reader = new FileReader();
    reader.onloadend = function(evt)
    if (evt.target.readyState == FileReader.DONE)
    var buffer = evt.target.result;
    var completeUrl = spWebUrl
    + "/_api/web/lists/getByTitle('"+ library +"')"
    + "/RootFolder/Files/add(url='"+ filename +"',overwrite='true')?"
    + "@TargetLibrary='"+library+"'&@TargetFileName='"+ filename +"'";
    $.ajax({
    url: completeUrl,
    type: "POST",
    data: buffer,
    async: false,
    processData: false,
    headers: {
    "accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    "content-length": buffer.byteLength
    complete: function (data) {
    //uploaded pic url
    console.log(data.responseJSON.d.ServerRelativeUrl);
    error: function (err) {
    alert('failed');
    reader.readAsArrayBuffer(file);
    </script>
    <input type="file" id='file' onchange="uploadFile()"/>
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Jason Guo
    TechNet Community Support

  • Button disabled until file upload is valid...

    elo. I have this application which uses a File Upload component. I can successfully upload the needed file.
    My application (part of it concerned) has a File Upload component and another button ("Submit"). The file upload works fine. The problem is, if i want to upload that file (meaning, copied to the hard disk) i have to press the "Submit" button, which is initially disabled. It can only be enabled if the File Upload's file is valid. If the file upload is cancelled, the "Submit" button should still be disabled. If the user selects a file, the "Submit" button should be enabled, so that the user can successfully upload the file.
    Help me with this please... Thanx.

    My suggestion is to use JavaScript for dynamically disabling and enabling the button based on "onClick" and "onBlur" javascript attributes of the FileUpload component.
    To get info about what kind of javascript used for FileUpload component
    - Go to the Projects tab
    - Explore the Libraries node and open Default Theme - defaulttheme.jar
    - Drill down to com.sun.rave.web.ui.defaultheme.javascript and dowuble click on formElements.js
    - Search for upload functions
    You should see the functions related to File Upload near
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // upload functions
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    - Winston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • Help with file upload

    I was wondering if there's a kind of lightweight component for uploading files in JSF. I tried Oracle's ADF Faces, but besides it being a couple of megs it screwed up the HTML code in my pages and some Javascript functions wouldn't work. I saw a post here where someone created his own component but as it will have minor use in my app i'd like something packed so I can just add it on.
    I only need to upload one file in my app, so maybe it's better to use a regular JSP and Servlet approach for this one. Suggestions or comments would be appreciated, thanks..

    I followed the examples in the chapter, but I needed a .tld file so I created one:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>file</short-name>
    <uri>http://java.sun.com/upload</uri>
    <display-name>JSF File Upload</display-name>
    <description>File upload library fo JSF</description>
    <tag>
    <name>upload</name>
    <tag-class>com.corejsf.UploadTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Uploads the file.
    </description>
    <attribute>
    <name>value</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>target</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    Its in WEB-INF and declared in web.xml, but I'm getting an error:
    javax.faces.FacesException: Expression Error: Named Object: 'com.corejsf.Upload' not found.
    There's no such class in the component, but the UploadTag returns "com.corejsf.Upload" in both getRenderedType() and getComponentType().
    If someone has this working; help please!!

  • Help:simple file upload example not working

    Request input on what's wrong with this -
    Using JDeveloper 10G.
    1) I created a simple jsp file upload file using the OJSP
    File Access Tag library options. With empty JSP file,I
    dropped in the httpUploadForm and the httpUpload tags.
    Now when I run this I get the following error stack on
    the web page.
    javax.servlet.jsp.JspTagException: Posted content type isnt multipart/form-data at oracle.jsp.webutil.fileaccess.tagext.HttpUploadTag.doStartTag(HttpUploadTag.java:130)at test4.jspService(test4.jsp:10)[test4.jsp]
    2)Now if I use a simple JSP without the tag library - the
    page fails to display. Found that commenting out the
    line "upbean.upload()" lets the page run and atleast
    show me the upload form. What's wrong with this
    standard example from the OC4J documentation -
    <%@ page import =
    "javax.servlet.http.*,
    java.io.*,
    java.util.*,
    oracle.jsp.webutil.fileaccess.*;" language="java" session="true" contentType="text/html;charset=windows-1252"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Upload</title>
    </head>
    <body>
    <% String userdir = "mydir"; %>
    <form action="pUpload.jsp" ENCTYPE="multipart/form-data" method=POST>
    <br>
    File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
    <br>
    <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send">
    </form>
    <jsp:useBean id="upbean" class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
    <jsp:setProperty name="upbean" property="destination" value="<%= userdir %>" />
    </jsp:useBean>
    <% upbean.setBaseDir(application, request);
    //upbean.upload(request);
    %>
    </body>
    </html>

    It's not clear from your post, but are you aware that the
    documentation is really showing multiple files?
    The doc examples are based on the ones you can try out by downloading the ojspdemos.ear file.
    They use discrete steps. For example, the fileUploadIndex.html contains the following
    This will call the form and set the action in the form to call the tag upload jsp file. The form will do the multi-part post and the tag upload file does display the text after the <upload:httpUpload> tag. I just re-ran the example to be sure.
    The same basic mechanism applies to the upload bean. That is it is called via:
    This is the only way that these can work because the upload code (beans & tags) both require a multi-part post. I hope this helps

  • File Upload in Web Dynpro

    Hi all,
    I need to upload file from user local computer into Web Dynpro context, but standard FileUpload component doesn't look very "attractive" to me. There are 3 main reasons:
    1. when user don't use Browse functionality, but he/she types directly for example == "xxxx" (not valid absolute windows path) into input field of FU Component and then click Upload, application freeze - and loading that 'file' forever.....
    2. don't know how to specify custom file types in showed FileChooser  (predefined are AllFiles, Pictures, HTML)
    3. Browse label is not internationalized, no possibility to change that text (and that button also looks "different" )
    How can I eliminate these minuses, or is here alternative solution for file uploading file in WD? My customer environment is NW 2004.
    Regards,
    Juraj

    Dynpro UI elements has limitations. But we can use them the way we want within these limitations.
    1. when user don't use Browse functionality, but he/she types directly for example == "xxxx" (not valid absolute windows path) into input field of FU Component and then click Upload, application freeze - and loading that 'file' forever.....
    If there is a fixed place to hold the documents, we can prefix the path upto the filename.
    2. don't know how to specify custom file types in showed FileChooser (predefined are AllFiles, Pictures, HTML)
    we can get the MIME type from the resource. And further processing can be restricted.
    3. Browse label is not internationalized, no possibility to change that text (and that button also looks "different" )
    I Agree that we can't change "Browse", but still we can have the orientation, if your browser is Arabic, it got aligned at right hand side.
    thread:
    nikhil
    Edited by: Nikhil ßos on Jul 3, 2008 1:07 PM

  • FILE UPLOAD PROBLEM SHOWING THE CONTENTS IN THE SAME BROWSER WINDOW

    Hi,
    This is amit Joshi
    I have uploaded content using input tag of type file and posted to jsp as multipart/form-data type
    in that jsp i am using following code to display the content in browser but only first content is displayed How can i modify it to show all content in the file ..
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
    FileItem fileItemTemp = (FileItem)it.next();
    if (fileItemTemp.isFormField()){
    %>
    <b>Name-value Pair Info:</b>
    Field name: <%= fileItemTemp.getFieldName() %>
    Field value: <%= fileItemTemp.getString() %>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
    optionalFileName = fileItemTemp.getString();
    else
    fileItem = fileItemTemp;
    if (fileItem!=null){
    String fileName = fileItem.getName();
    %>
    <b>Uploaded File Info:</b>
    Content type: <%= fileItem.getContentType() %>
    Field name: <%= fileItem.getFieldName() %>
    File name: <%= fileName %>
    <%
    if(fileItem.getContentType().equals("image/jpeg")) { %>
    File : <p><%
         //response.setContentType("image/gif");
         byte[] bArray=fileItem.get();
         response.setContentType("image/jpeg");
         outputStream=null;
         outputStream= response.getOutputStream();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    else if(fileItem.getContentType().equals("text/plain"))
         %> File : <%= fileItem.getString() %>
    <%
    byte[] bArray=fileItem.get();
    response.setContentType("text/plain");
         outputStream = response.getOutputStream();
         out.println();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    %> </p> <%
    %>
    </body>
    </html>
    Edited by: Amit_Joshi on Nov 13, 2007 10:58 PM

    Well Well Well..
    That would not work...
    What you have to do is save the uploaded file content on to a location and then pass the fileName as a request parameter to a deidicated which displays the contents of that file.
    Just as an example
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
       FileItem fileItemTemp = (FileItem)it.next();
    %>
    Name-value Pair Info:
    Field name: <%= fileItemTemp.getFieldName() %><br/>
    Field value: <%= fileItemTemp.getString() %><br/>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
        optionalFileName = fileItemTemp.getString();
    if(!fileTempItem.isFormFiled()){
       String fileName = fileItem.getName();
       fileItem.write(optionalFileName);
    %>
    Uploaded File Info:
    Content type: <%= fileItem.getContentType() %><br/>
    Field name: <%= fileItem.getFieldName() %><br/>
    File name: <%= fileName %><br/>
    <%
    if(fileItem.getContentType().equals("image/jpeg") || fileItem.getContentType().equals("image/pjeg")) {
    %>
      <img src="FileServlet?fileName=<%=optionalFileName%>"   
    <%
    %>
    </body>
    </html>a sample code snippet for FileServlet.
    String fileName =  request.getParameter(fileName);
      File file = new File(fileName);
       if(!file.exists())
         return;
      // If JSP
      String mimeType = application.getMimeType("fileName");
           If you are using servlet
           String mimeType = this.getServletContext().getMimeType(fileName);
         response.setContentType(mimeType);  
         response.setHeader("Content-Disposition","inline;filename=\\"+fileName+"\\");
      BufferedOutputStream out1 = null;
      InputStream in = null;
      if(mimeType == null)
         mimeType = "application/octet-stream";
      try{
         in = new FileInputStream(f);
         response.setContentLength(in.available());
         BufferedOutputStream out1 = new BufferedOutputStream(response.getOutputStream(),1024);
         int size = 0;
         byte[] b = new byte[1024];
         while ((size = in.read(b, 0, 1024)) > 0)
            out1.write(b, 0, size);
      }catch(Exception exp){
      }finally{
          if(out1 != null){
             try{
                out1.flush();               
                out1.close();
             }catch(Exception e){}
          if(in != null){
            try{in.close();}catch(Exception e){}
      } Hope that might answer your question :)
    However,this is not the recommended way of doing this make use of MVC pattern.Would be a better approach.
    you might think of googling on this and can findout what is the best practise followed for problems of this sort
    REGARDS,
    RaHuL

  • Problem in uploading file from Application Server

    Hi everyone,
    i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.

    Ramesh,
    Take authorization from basis guy.
    Use the below code to get the list of files from require directory
    *& Report  ZDIRFILES                                                   *
    REPORT  ZDIRFILES    .
    PARAMETER: p_fdir            type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
            include structure salfldir.
    data: end of it_filedir.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
      call function 'RZL_READ_DIR_LOCAL'
           exporting
                name     = p_fdir
           tables
                file_tbl = it_filedir.
    Now in internal table "it_filedir"  will have all your files.
    For moving and deleting
    report zrich_0001.
    Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
                d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
    data: begin of itab occurs 0,
          rec(20) type c,
          end of itab.
    data: wa(20) type c.
    start-of-selection.
      open dataset d1 for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset d1 into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset d1.
      open dataset d2 for output in text mode.
      loop at itab.
        transfer itab to d2.
      endloop.
      close dataset d2.
      delete dataset d1.
    Check below FM if required
    To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
    To Delete 'EPS_DELETE_FILE'.
    Don't forgot to reward if useful

  • Threading problem during File Upload with Apache faces upload tag

    First I am going to tell you "My Understanding of how JSF Apache Upload works, Correct me if i am wrong".
    1) Restores View (to show Input box and Browse button to facilitate users to select a file for upload)
    2) Translates Request Parameters to Component Values (Creates equivalent components to update them with request values).
    3) Validates Input(Checks to see whether the User has input the correct file)
    4) Updates Backing Bean or Model to reflect the values.
    5) Renders response to user.
    I am uploading huge files of sizes 400MB and above with the help of JSF apache extensions tag
    <h:form id="uploadForm" enctype="multipart/form-data">
    <x:inputFileUpload style="height:20px;" id="upload" value="#{backingbean.fileContents}" storage="file" size="50" />
    </h:form>
    In the backing bean
    private UploadedFile fileContents;
         public UploadedFile getFileContents() {
              return fileContents;
         public void setFileContents(UploadedFile fileContents) {
              System.out.println("File being uploaded...");
              this.fileContents = fileContents;
    Since, the file size is so huge, I am using temp folder to use for the apache tag instead of memory.
    In web.xml i am using like this
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>600m</param-value>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>10m</param-value>
    </init-param>
         <init-param>
    <param-name>uploadRepositoryPath</param-name>
    <param-value>/uploadfolder/</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    The upload process is working perfectly fine.
    Now coming to the problem:
    Suppose one user is logging into the application & uploading say 400MB of files.
    Until these files are linked to the model objects as my understanding of step 2, if second user tries to open the application he gets stuck with the loading page.
    The page gets loaded only after the request files are linked to the component values(Step 2 above) and updates the backing bean's values.
    I don't see any error in the logs. User is getting stuck. The user is getting stuck only when uploading the files. The other operations like searching are not blocking any other activities performed by the user.
    Server used: IBM Application Server V6.0. CPU is normal, memory usage is normal.

    Dear friend,
    i am also trying to upload using the common file upload.
    when try to run the file error is coming
    can give some suggestion.
    can i use if concurrent user file upload at a time

Maybe you are looking for

  • Neo4 and X2...

    Got the Neo4 and am getting ready to get new CPu - as I understand it the last BIOS released had the needed update for X2 processors?  Can someone confirm this for me?

  • Cannot download full DVD Movie Factory version for Satellite A100 and clean Vista

    Hi there I made a clean Windows Vista orgianal upgrade set from Modus link. Installed and now when a want to install the DVD Movie Factory patch (DMF5.51_Patch_18in1_for TOSHIBA_147.05_0718) there is no dvd creator software installed and also no cd c

  • Signed applet works on pc  but can't print on mac! security issue!

    Hello I have an applet which works beautifully on the pc under ie, firefox, chrome and safari. Essentially - it uses the batik libraries to download an svg file and then print it. Problem is that firstly - no matter which operating system or browser

  • Ibook g3 no start up after charging?

    ok my ibook g3 (sept 02) was stuck in sleep mode (low batt) charger was unplugged so i plugged it in, charged the ibook now it will not start back up no lights or sounds . This is my frist apple and i got it used, and used it for only 4 mins so any i

  • Super 8 interlaced confusion whilst editing and exporting

    Hi folks I recently had my old super 8 films telecined to disc as .avi at 18fps. I could have had them copied to a DV tape instead but due to the interlacing problems that would have caused I decided to transfer to an avi file. Now in a earlier post