File uploads from Flex

How do I enable CF to allow file uploads from Flex?

You will need to set the accept attribute of the cffile tag
to allow the mime type application/octet-stream.

Similar Messages

  • File Upload using Flex/ColdFusion.  2044 error

    I am looking for a little more clarity around the file upload using Flex and Cold Fusion.  When I run this using my server I get Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.
    I did create a regular cfform and had it use my ColdFusion upload form and that worked fine, so I feel good about the upload form. I am starting to think there is a permission error with the Flash Player writing to the folder.  When this is ran, it will show the file being 100% loaded but the complete event is never triggered.  I put alerts to see where it hits and 100 does show at the same time as my error message.  The complete alert never shows.  I also put an alert in my cfm page and it never reaches that page to hit it.  Whether I use an absolute URL or relative path. I have also tried the urlrequestmethod.post and nothing changed.  Thanks in advance.  BTW.  I am using Flex 3.
    This is my mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="com.example.*" horizontalAlign="center" viewSourceURL="srcview/index.html">
    <mx:Script>
    <![CDATA[
    import com.example.FileDownload 
    import mx.controls.Label 
    import com.example.FileUpload]]>
    </mx:Script>
    <mx:Label id="title" text="File I/O Example" fontSize="24" fontStyle="bold" />
    <mx:Text id="subtitle" text="From Programming ActionScript 3.0, Chapter 22: Networking and communication" width="100%" textAlign="center" fontSize="12" /><example:FileDownload 
    id="fileDownload" creationComplete="fileDownload.init(downloadProgress, cancelDownload);" />
    <example:FileUpload id="fileUpload" creationComplete="fileUpload.init(uploadProgress, cancelUpload);" />
    <mx:HBox>
    <mx:Panel title="Upload File" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
    <mx:ProgressBar id="uploadProgress" label="" mode="manual" />
    <mx:ControlBar horizontalAlign="right">
    <mx:Button id="startUpload" label="Upload..." click="fileUpload.startUpload();" />
    <mx:Button id="cancelUpload" label="Cancel" click="fileUpload.cancelUpload();" enabled="false" />
    </mx:ControlBar>
    </mx:Panel>
    <mx:Panel title="Download File" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
    <mx:ProgressBar id="downloadProgress" label="" mode="manual" />
    <mx:ControlBar horizontalAlign="right">
    <mx:Button id="startDownload" label="Download..." click="fileDownload.startDownload();" />
    <mx:Button id="cancelDownload" label="Cancel" click="fileDownload.cancelDownload();" enabled="false" />
    </mx:ControlBar>
    </mx:Panel>
    </mx:HBox></mx:Application>
    here is my coldfusion upload script
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <script>alert('hello')</script>
    <cfset currentPath = getCurrentTemplatePath()>
    <cfset currentDirectory = getDirectoryFromPath(currentPath)>
    <cfoutput>This directory is #currentDirectory#</cfoutput>
    <cffile action="UPLOAD" filefield="Filefield" destination="#currentDirectory#" nameconflict="OVERWRITE"/>
    </body>
    </html>
    here is the package
    package  
    com.example { import flash.events.*; 
    import flash.net.FileReference; 
    import flash.net.URLRequest; 
    import flash.net.URLRequestMethod; 
    import mx.controls.Button; 
    import mx.controls.ProgressBar; 
    import mx.core.UIComponent; 
    import mx.controls.Alert; 
    public class FileUpload extends UIComponent { 
    // Hard-code the URL of the remote upload script. 
    private const UPLOAD_URL:String = "upload_script.cfm"; 
    private var fr:FileReference; 
    // Define reference to the upload ProgressBar component. 
    private var pb:ProgressBar; 
    // Define reference to the "Cancel" button which will immediately stop the upload in progress. 
    private var btn:Button; 
    public function FileUpload() {}
    /*** Set references to the components, and add listeners for the SELECT,
    * OPEN, PROGRESS, and COMPLETE events.
     public function init(pb:ProgressBar, btn:Button):void { 
    // Set up the references to the progress bar and cancel button, which are passed from the calling script. 
    this.pb = pb; 
    this.btn = btn; 
    fr =
    new FileReference();fr.addEventListener(Event.SELECT, selectHandler);
    fr.addEventListener(Event.OPEN, openHandler);
    fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    // fr.addEventListener(Event.COMPLETE, completeHandler); 
    /*** Immediately cancel the upload in progress and disable the cancel button.
     public function cancelUpload():void {fr.cancel();
    pb.label =
    "UPLOAD CANCELLED";btn.enabled =
    false;}
    /*** Launch the browse dialog box which allows the user to select a file to upload to the server.
     public function startUpload():void {fr.browse();
    /*** Begin uploading the file specified in the UPLOAD_URL constant.
     private function selectHandler(event:Event):void { 
    var request:URLRequest = new URLRequest(UPLOAD_URL); 
    /* request.url = UPLOAD_URL*/request.method = URLRequestMethod.POST;
     try  
    {fr.upload(request);
    }catch (error:Error){
    trace  
    ("error uploading")}
     /*** When the OPEN event has dispatched, change the progress bar's label
    * and enable the "Cancel" button, which allows the user to abort the
    * upload operation.
     private function openHandler(event:Event):void {pb.label =
    "UPLOADING";btn.enabled =
    true;}
    /*** While the file is uploading, update the progress bar's status and label.
     private function progressHandler(event:ProgressEvent):void {pb.label =
    "UPLOADING %3%%";pb.setProgress(event.bytesLoaded, event.bytesTotal);
    if(event.bytesLoaded==event.bytesTotal){ 
    trace(Event.COMPLETE)Alert.show(
    "100")}
    /*** Once the upload has completed, change the progress bar's label and
    * disable the "Cancel" button since the upload is already completed.
     private function completeHandler(event:Event):void {Alert.show(
    "in function")pb.label =
    "UPLOADING COMPLETE";pb.setProgress(0, 100);
    btn.enabled =
    false;}

    Presumably you need to add a result handler to your request.

  • "Import from Text File" & "Upload from Clipboard" icon not appearng in F110

    Hi Experts,
    While making the payment to the vendors through TN F110, in "PARAMETER" screen just next to 'STATUS' screen, there is a vendor field for selection in range and just ahead of this there is an icon for multiple vendor selection ( Bold arrow mark ). If I click on that multiple vender selection icon ( on bold arrow mark ), an another screen opens for multiple selection for vendors. In this screen 'Enter, Copy, Delete etc' icons are appearing at the bottom of the screen but "Import from Text File" & "Upload from Clipboard" icon are not appearing there.
    Can you please let me know how to bring that icons there?
    Points would be awarded.
    Rgds,
    Shailesh

    Hi Ravi,
    I have not yet created anything and have just entered the parameter. In the multiple screen for vendors there are 5 fields for individual and 5 for range selection. Even you can put more than five range selections or individual selections by clicking on the page button but there I am not finding these two icons.
    Can you please check at your end and let me know if you are getting or what to do to bring those two icons in F110.
    Rgds,
    Shailesh

  • Access file object from flex web app

    Hi all,
    I want to access file object from flex web app. What should i do?
    I have to take array from my XML. In XML there will be only dir path. So for taking file name from dir i have to access it and have to perform for loop on that dir.
    What should I do?
    Any Ideas?
    Thanks,
    -CK

    Hi Michael
    My question is that I dont want to give name of images in XML file.
    In XML file there will be only path of image directory. So I need to find all image name from that image directory.
    Thats why I want to access file object.
    Any ideas?    

  • Differentiate file uploaded from explorer view in SharePoint

    Hello,
    I am working on event receiver which on item adding updates few fields of document in library if those are not empty. The code is working fine in new file, drag and drop but in explorer view, I am not getting afterproperties values except two default field
    values (vti_parserversion and vti_filesize). But in updating event we are getting those values.
    Is there any way to differentiate file uploaded using explorer view in event receiver? So that I can work on updating in case of explorer view.
    Thanks.

    Hi,
    According to your post, my understanding is that you want to differentiate file uploaded from explorer view in SharePoint 2013.
    I made a test in my environment, both the two ways(“new document” or “Open with explorer” ) to upload document, the AfterProperties only contains two default field values(vti_parserversion and vti_filesize) in
    ItemAdding method in event receiver.
    There are two steps occur when uploading a file to document library, the file is uploaded in the first step, then the list item properties will be modified in the second step. 
    So, it is recommended to update the fields of document in ItemUpdating
    method in event receiver.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Issues with file upload in flex mobile application (sharepoint as backend)

    Hello,
    I am working on flex mobile application for android platform for which we are having sharepoint as a backend.
    (Flex SDK 4.6 and AIR 3.9)
    Issue which we are facing is as follows:
    We are communicating with the backend server using webservices: example:
    <s:WebService id="kWebService" wsdl="http://www.kservice.net/kdatabaseservice.asmx?WSDL" >
                <s:operation name="AddPost"
                             resultFormat="object"
                             result="addPostResult(event)"
                             fault="postsfaulterr(event)" />
    </s:WebService>
    Above services are working fine but we are facing issue with one service which is related to file upload.
    File upload for <10 MB is working fine but when we try to upload larger file on server it fails to process.
    We are sending bytearray to the backend and backend code is writing those bytearray into file.
    We have tried many ways to overcome from this situation. like we have checked configuration for file upload size on server , we have tried wcf services as well. Please help us on this criticle point as soon as possible
    Thanks
    Dhwani

    Prashant8809 wrote:
    Hi
    >
    > I have already gone through the video by Thomas Jung for multiple file upload but it saves the contents in server and not in >transparent table. So please suggest me alternative solutions.
    >
    >
    > Regards
    > Prashant Chauhan
    What do you mean that my video saves the contents int he server and not in transparent table?  I save the data into a temporary database table so it can be accessed by the parent WDA session. From there the WDA session can do whatever it wants with it.  What do you mean by transparent table - that would be a database table. Do you actually mean internal table?  if so, just read the data from the temporary database table into memory.

  • LSMW file upload from presentation server

    Hi,
    We are using LSMW to create new Document info records and will need to upload/ attach multiple files to the DIR.
    everything is working except in the IDOC processing stage, it errors out -
    "Error while checking in and storing:
    otlta134a\pcm\test1.txt"
    Its is unable to upload file from network drive, it works successfully when the same file is uploaded from application server.
    I have worked in other LSMW projects and have successfully loaded files from network drive.
    Please let me know what configuration setup is required, is it the content server or the gateway server?
    Thanks for all your help.

    Sheetal,
    I think this is the problem due to the authorization....
    try to open the file from AL11........... if u r still getting the problem better to contact the basis guys...
    If it is the problem with the authorization... once u get this error open another session with SU53 tcode.. take the authorization object and give it to basis guys to allow the permissions to u...

  • JSP : latest  JSTL, File Upload from web form Client to Server Question!

    I understand that within a JSP, It is possible to read a file from the Client by opening a Stream somehow.
    How do I code, within jsp/servlet (non tag) java code inside <% %>
    blocks, WITHOUT openening a new connection to the URL, an InputStream from a client web browser form, from a file upload coded using
    <input type="file" name="file1"/> ?
    I have previously achieved this quite simply with a FileInputStream
    with the previous version of JSTL.
    How may I do this with the latest version of JSTL, with this index.jsp?
    -with a simple text file.
    -with a Binary file (with DataInputStream)?
    <%--
    Document : index
    Created on : 27/01/2009, 3:08:32 PM
    Author : Zachary Mitchell
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1 align="center">Hello World!</h1>
    <form name="form1" method ="POST" >
    <table align="center">
    <tr>
    <td>
    <input name="file1" type="file" align="center"></input>
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="submit" action="index.jsp" ></input>
    </td>
    </tr>
    </table>
    </form>
    <!--*********************************************************************** -->
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <%@page import = "java.io.*" %>
    <c:if test="${pageContext.request.method=='POST'}">
    <%
    File fileName = new File(request.getParameter("file1"));
    out.println(fileName.toString());
    FileInputStream stream = new FileInputStream(fileName);
    out.println(stream.toString());
    %>
    </c:if>
    <!--*********************************************************************** -->
    </body>
    </html>

    If I have:
    <!-- ***********************************************************************************-->
    <form name="form1" method="POST" enctype="multipart/form-data">
    <input name="file1" type="file"/>
    <input name="submit1" type="submit" value="Submit" action="index.jsp"/>
    </form>
    <!-- ***********************************************************************************-->
    and run this in an index.jsp, use browse to select my text file, and click SUBMIT.
    I can use:
    InputStreamReader reader = new InputStreamReader(new DataInputStream(request.getInputStream()))
    BufferedReader bufferedReader = new BufferedReader(reader);
    bufferedReader.readLine();...
    However, these is some HTML/POST related content around what multiple readLine();
    calls return.
    Is there an easy way, like using "${param.file1}",
    aside from [http://commons.apache.org/fileupload/|http://commons.apache.org/fileupload/],
    maybe using servlet style code, to get the File contents from a remote Client,
    to the remote Server servlet engine, AVOIDING ANY SUPERFLUOUS CONTENT,
    using version 1.12 of the JSTL, JSP 2.0,Tomcat 6?
    Just politely, yes, no, and how?
    Edited by: Zac1234 on Jan 29, 2009 3:27 AM
    Edited by: Zac1234 on Feb 1, 2009 8:29 PM

  • File Uploading from one system to another system

    Hi to all
    I acn any one give a sample code for uploading from one system to another system using java code.
    please very urgent
    Thanks in advance
    With Regards
    Jitendra

    I am very sorry for that
    What i want is to transfer a file from my system to
    another system using Http connectionDoes the other system support http uploads?
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=451245

  • Flat File Upload from Network

    Hi gurus,
    i understood that there is a posibility to upload data from a flat file directly from the network. I know how to upload it from the PC, but how do I put the folder on the network?
    Thanx,
    Ramona

    Hi Ramona,
    First of all make sure, that every user has sufficiant auothraization for durectory required on application server,
    Now  you (or the users) are able to access it in windows after  mapping  to a drive represented by a caharcter ( e.g. ''R").
    This is done in Windows Explorer "EXTRAS". It will appear as a new folder in explorer and can be handled like a "normal" one.
    If you have any doubts contact your basis guys, they are surely familiar with this process.
    Hope it helps
    Joe

  • File upload from smartphone?

    Currently your file upload field does not allow smartphone users to upload images/videos, any chance this may be possible soon?
    I used the following html5 coding on a separate site page and works well:
    <form action="server.cgi" method="post" enctype="multipart/form-data">
      <input type="file" name="video" accept="video/*" capture>
      <input type="submit" value="Upload">
    </form>
    Hoping this is also possible within your form but looks lke I'm not allowed to edit the form's html.
    Thanks for your help.
    Dave B

    This is something we are looking into. Can't say when it might be supported.
    Randy

  • Flat file upload (from local system) to internal table

    I am trying to use BAPI to create sales order. for that I have to upload flat file containing header and item data from the local system (not from application server). please suggest me if any functional module is available for this.
    Thanks,
    Rajan

    Hi rajan,
    Try this,
    CALL FUNCTION 'GUI_UPLOAD'
            EXPORTING
              filename                        = lv_filename              " File name
              filetype                         = 'ASC'
           has_field_separator          = cl_abap_char_utilities=>horizontal_tab
      HEADER_LENGTH             = 0
      READ_BY_LINE                 = G_MARKED
      DAT_MODE                       = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                 = ABAP_TRUE
      REPLACEMENT                = '#'
      CHECK_BOM                    = ' '
      VIRUS_SCAN_PROFILE     = VIRUS_SCAN_PROFILE
      NO_AUTH_CHECK             = ' '
    IMPORTING
      FILELENGTH                     = FILELENGTH
      HEADER                           = HEADERf
            TABLES
              data_tab                      = gt_table         "internal table with fields from the flat file.
           EXCEPTIONS
             file_open_error               = 1
             file_read_error               = 2
             no_batch                      = 3
             gui_refuse_filetransfer    = 4
             invalid_type                  = 5
             no_authority                 = 6
             unknown_error              = 7
             bad_data_format           = 8
             header_not_allowed       = 9
             separator_not_allowed   = 10
             header_too_long            = 11
             unknown_dp_error         = 12
             access_denied              = 13
             dp_out_of_memory        = 14
             disk_full                       = 15
             dp_timeout                   = 16
             OTHERS                      = 17
    Regards,
    Shobana.K

  • Shortdump on File upload from unix and CX_SY_CONVERSION_CODEPAGE

    Hi,
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was no
    caught in
    procedure "OPEN_INPUT_FILE" "(FORM)", nor was it propagated by a RAISING
    clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.
    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4102' is not known to the system.
    Example: µ is creating problems.
    I have a problem in uploading the file with below format
    F091US122580164           PECOSPHERE C18,3µm,33X4.6MM
    1. I am using a custom program to read the file and then updating internal table
    2. Unicode code system
    Please help to resolve this issue.
    Thanks and Regards,
    Raveendra

    Hi Raveendra,
    Similar problem is faced by me in my current project. The solutions I have suggested are as below. I have not received any confirmation as to which solution to be applied.
    To avoid the dump:
    1. Read the file as a NON UNICODE file.
         -- For this we use open dataset statement as OPEN DATASET <name> IN TEXT MODE FOR INPUT ENCODING NON-UNICODE. The file is read as a non-Unicode file. This avoids the dump but it uploads also the non Unicode data in the system. We need to analyse if this will cause any other effect on the system.
    2. Upload file after removing the special characters
         -- We need to upload the file again in the application server after removing the special characters in it.
    3. Bypass the dump by displaying error message
         -- By using OPEN DATASET........IGNORING CONVERSION ERROR, we can suppress the dump. Here the file is not         read but only the dump is suppressed.
    regards,
    Gaurav

  • Flat File Upload from WebDynpro ABAP

    Hi,
    I am struggling to find a solution for this requirement and I hope I get some help from the Gurus here.
    I have to upload a ".csv" file from the WebDynpro application, and then store the data in the flat file in a Z# table.
    Can some one explain me how to go ahead with this requirement??
    Regards,
    Nadh

    Hi Nrisimhanadh Yandamuri  ,
    After reading the csv file using file up load you can use the following code to tranfer the same to an itab of your required format
        DATA : loc_conv TYPE REF TO cl_abap_conv_in_ce,
          var_string TYPE string.
    Convert XString to String
        CALL METHOD cl_abap_conv_in_ce=>create
          EXPORTING
            input       = item_content
            encoding    = 'UTF-8'
            replacement = '?'
            ignore_cerr = abap_true
          RECEIVING
            conv        = loc_conv.
    *Read the file contents
        TRY.
            CALL METHOD loc_conv->read
              IMPORTING
                data = var_string.
          CATCH cx_sy_conversion_codepage.
    *-- Should ignore errors in code conversions
          CATCH cx_sy_codepage_converter_init.
    *-- Should ignore errors in code conversions
          CATCH cx_parameter_invalid_type.
          CATCH cx_parameter_invalid_range.
        ENDTRY.
        SPLIT var_string AT crlf INTO TABLE it_string_tab.
    Regards
    Sarath

  • File upload from ftp

    How can i upload file from ftp server to DMS content server.
    i have try with BAPI_DOCUMENT_CREATE2 it working ok if i am give source path of my local pc file.
    but if i use ftp path than it is giving errer
    " E26                  253Error while checking in and storing: FTP://10.2.16.137/SENDER/Z12345.PDF"
    is there other settings for using ftp.
    and my ftp is open no restriction is there?

    Dear Alex,
    Can u provide how did u solve to create DIR Record from FTP,
    We are having the same requirement and facing problem
    errro while checking and storing...
    Regards,
    Tushar

Maybe you are looking for