Displaying progressbar for file upload

后端 未结 3 1031
名媛妹妹
名媛妹妹 2020-12-21 16:18

I need to create an application where I can add files for upload. As I add items for upload, a progressbar should be displayed along with each item added. And when I click f

相关标签:
3条回答
  • 2020-12-21 16:20

    Here are two great examples of Flex file uploaders (using HTTP):

    • Flex File Uploader using PHP, with source.
    • Merb and Adobe AIR File Uploader, with source.

    alt text http://blog.vixiom.com/uploads/merb_air_upload.png

    In order to make the above two examples work together to achieve the desired result (multiple file uploader, one ProgressBar per preloader, in Flex), all you need to do is:

    1. Download the Flex File Uploader PHP Project
    2. Download the Merb AIR Uploader and copy/paste the "UploadProgressComponent.mxml" somewhere into the PHP project (copy to src/UploadProgressComponent.mxml for now).
    3. Replace the DataGrid with a List and a Custom ItemRenderer in FileUpload.mxml in the Flex File Uploader PHP Project.

    Replace this:

    <mx:DataGrid id="listFiles" left="0" top="0" bottom="0" right="0"  
     allowMultipleSelection="true" verticalScrollPolicy="on"
     draggableColumns="false" resizableColumns="false" sortableColumns="false">
        <mx:columns>
            <mx:DataGridColumn headerText="File" dataField="name" wordWrap="true"/>
            <mx:DataGridColumn headerText="Size" dataField="size" width="75" textAlign="right"/>
        </mx:columns>
    </mx:DataGrid>  
    

    with this:

    <mx:List id="listFiles" left="0" top="0" bottom="0" right="0"
     allowMultipleSelection="true" verticalScrollPolicy="on"
     itemRenderer="UploadProgressComponent"/>  
    

    The result: Multiple file uploader in Flex, with a custom ItemRenderer that has a ProgressBar for each FileReference. Uploads to a PHP script, which you can swap out for anything.

    Should be very easy to customize from there. Let me know if that works, Lance

    0 讨论(0)
  • 2020-12-21 16:35

    See these examples:

    Multiple File Upload with Flex and PHP
    which looks like this:

    image1

    Multiple File Upload With Progress Bar Using Flash and ASP.NET
    which looks like this:

    image2

    0 讨论(0)
  • 2020-12-21 16:40

    Flex has a ProgressBar class, have you checked that out yet?

    0 讨论(0)
提交回复
热议问题