prev | index | next

Flash8 - File upload
8
24
1177 bytes
1949 bytes
2005-10-12 00:00:00
2007-09-05 14:02:21
Oldes (oliva.david@seznam.cz)


To test file uploading possibility of the Flash 8

(swf8-fileupload.rswf)
background 255.255.255
include %includes/txt_info2.rswf
doAction [
    tf_info._visible: true
    tf_info._height: 319
    tf_info._width: 399
    tf_info.border: true
    cmsg("File upload test... select an image you want to upload.")
    imageTypes: make object! [
        description: "Images (*.jpg, *.jpeg, *.gif, *.png)"
        extension:   "*.jpg; *.jpeg; *.gif; *.png"
    ]
    allTypes: [imageTypes]

    listener: make object! []
    listener.onSelect: func[file][
        cmsg((reform [
            "onSelect:" file.name
            "^/  size:" file.size "bytes"
            "^/  type:" file.type
            "^/  modificationDate:" file.modificationDate
            "^/  creationDate:    " file.creationDate
            "^/  creator: " file.creator
        ]))
        either file.size <= 100000 [
            if not file.upload("http://box.lebeda.ws/~hmm/rswf/uploadexample.php") [
                cmsg("Upload dialog failed to open.")
            ]
        ][
            cmsg((reform ["The file is too large for uploading!"]))
        ]
    ]
    listener.onCancel:    func[file][cmsg("onCancel")]
    listener.onOpen:      func[file][cmsg((reform ["onOpen:" file.name]))]
    listener.onProgress:  func[file bytesLoaded bytesTotal][
        cmsg((reform ["onProgress with bytesUpLoaded:" bytesLoaded "bytesTotal:" bytesTotal]))
    ]
    listener.onComplete:  func[file][cmsg((reform ["onComplete:"  file.name]))]
    listener.onHTTPError: func[file httpError][cmsg((reform ["onHTTPError:" file.name httpError]))]
    listener.onIOError:   func[file][cmsg((reform ["onIOError:"   file.name]))]
    listener.onSecurityError: func[file errorString][
        cmsg((reform ["onSecurityError:" file.name "errorString:" errorString]))
    ]
    var fileRef: make FileReference! []
    fileRef.addListener(listener)
    fileRef.browse(allTypes)
]

showFrame
end