![]() |
URLSimpleUpload |
||||
Header: | URLAccess.h | Carbon status: | Supported | |
Uploads a file or directory to an FTP URL specified by a character string.
OSStatus URLSimpleUpload ( const char *url, const FSSpec *source, URLOpenFlags openFlags, URLSystemEventUPP eventProc, void *userContext );
A pointer to a C string representing the URL to which a file or directory is to be uploaded. If you wish to replace the destination directory of this URL with the file or directory that you pass in the source parameter, terminate the string with a slash character (/), and set the mask constant kURLReplaceExistingFlag in the openFlags parameter. If you specify a name that already exists on the server and do not specify kURLReplaceExistingFlag, URLSimpleUpload returns the result code kURLDestinationExistsError. If you do not specify a name, do not specify kURLReplaceExistingFlag in the openFlags parameter, and the name already exists on the server, the URL Access Manager creates a unique name by appending a number to the original name before the extension, if any. For example, if the URL specifies a file named file.txt, URLSimpleUpload changes the filename to file1.txt. See Naming Your Destination File for more information.
A pointer to a file specification structure that describes the file or directory you want to upload.
A bitmask that indicates the data transfer options to use. You can specify any of the following masks for uploading options: kURLReplaceExistingFlag, kURLBinHexFileFlag, kURLDisplayProgressFlag, kURLDisplayAuthFlag, and kURLDoNotTryAnonymousFlag. See
A Universal Procedure Pointer (UPP) to your system event callback function, if one exists. For information on how to write a system event callback, see URLSystemEventProcPtr. If you want to handle events that occur while a progress indicator or authentication dialog box is being displayed, specify the appropriate mask (either kURLDisplayProgressFlag or kURLDisplayAuthFlag) in the openFlags parameter and pass a UPP to your callback function in this parameter. Pass NULL if you do not want to receive notification of these events. In this case, the URL Access Manager displays a nonmovable modal progress indicator or authentication dialog box.
A pointer to application-defined storage that will be passed to your system event callback function, if one exists. Your application can use this to set up its context when your system event callback function is called.
A result code. The result code kURLDestinationExistsError indicates that you specified a pathname that already exists on the server but did not set the bit specified by the mask constant kURLReplaceExistingFlag in the openFlags parameter. If your application is multi-threaded, and more than one thread calls URLSimpleUpload simultaneously, URLSimpleUpload returns the result code kURLProgessAlreadyDisplayedError if you specify kURLDisplayProgressFlag in the openFlags parameter and the URL Access Manager is already displaying a progress indicator.
The URLSimpleUpload function uploads a file or directory to an FTP URL specified by a pathname. It does not return until the upload is complete. If you want to upload data from a URL identified by a reference rather than a pathname, call the function URLUpload. The difference between the two functions is that URLUpload allows you to access other URL Access Manager functions before, after, or during the download. If you want more control over a data transfer operation, call the function URLOpen.
URLSimpleUpload yields time to other threads. Your application should call URLSimpleUpload from a thread other than the main thread so that other processes have time to run.
In Mac OS 8.6, if the file type of the file to be uploaded is unknown, URLSimpleUpload assumes that the file is of type text. In this case, the end-of-line character is changed to the Mac style end-of-line character 0x0d0x0a. In Mac OS 9, when a file of unknown type is uploaded, URLSimpleUpload does not assume that it is a text file. Instead, it identifies it as an unknown file type and does not change the end-of-line character.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)