Developer --> Technical Publications

     


Performing Simple Data Transfer

The URL Access Manager provides four high-level functions for performing simple upload and download operations. These functions are synchronous, meaning that they return control to your application upon completion. If you want more control over the data transfer than these functions afford, see the description of the function URLOpen in Controlling Data Transfer.

To perform simple download operations, you can call the function URLSimpleDownload or URLDownload . The difference between these functions is that URLSimpleDownload takes a character string as the URL, while URLDownload takes a URL reference. If you calll URLDownload and pass a URL reference, you can perform a number of additional operations on the reference, including manipulating and obtaining its properties.

To perform simple upload operations, you can call the function URLSimpleUpload or URLUpload . Like URLSimpleDownload , URLSimpleUpload takes a character string as the URL. URLUpload takes a URL reference, and like URLDownload , allows you to perform additional operations.

You can specify the data transfer options that these functions should use by passing the appropriate bitmask in the openFlags parameter. For upload operations, the options you can specify include whether to replace an existing file, display a progress indicator bar during data transfer operations, display an authentication dialog box if the URL Access Manager requires authentication, decode an encoded file and expand it if the Stuffit Engine is installed, specify that URL is a directory, or download a directory listing instead of the contents of a file or directory. For download operations, you can set any of the following masks: kURLReplaceExistingFlag , kURLExpandFileFlag , kURLExpandAndVerifyFlag , kURLDisplayProgressFlag , kURLDisplayAuthFlag , kURLIsDirectoryHintFlag , kURLDoNotTryAnonymousFlag , or kURLDirectoryListingFlag .

Prior to Mac OS X, if you want update events to be passed to your application while dialog boxes are displayed by any of these functions, you should write your own system event callback function. Pass a pointer to it in the eventProc parameter of the appropriate function.


© 2000 Apple Computer, Inc. (Last Updated 20 July 2000)