PFFileUploadController

Objective-C

@protocol PFFileUploadController <NSObject>

Swift

protocol PFFileUploadController : NSObjectProtocol

A policy interface for overriding the default upload behavior of uploading a PFFileObject to application’s parse server. Allows for direct uploads to other file storage providers.

  • Uploads a file asynchronously from file path for a given file state.

    Declaration

    Objective-C

    - (BFTask<PFFileUploadResult *> *_Nonnull)
        uploadSourceFilePath:(NSString *_Nonnull)sourceFilePath
                    fileName:(NSString *_Nullable)fileName
                    mimeType:(NSString *_Nullable)mimeType
                sessionToken:(NSString *_Nonnull)sessionToken
           cancellationToken:(id)cancellationToken
               progressBlock:(PFProgressBlock _Nonnull)progressBlock;

    Swift

    func uploadSourceFilePath(_ sourceFilePath: String, fileName: String?, mimeType: String?, sessionToken: String, cancellationToken: Any!, progressBlock: Any!) -> Any!

    Parameters

    sourceFilePath

    Path to the file to upload.

    fileName

    The PFFileObject’s fileName.

    mimeType

    The PFFileObject’s mime type.

    sessionToken

    The current users’s session token.

    cancellationToken

    Cancellation token.

    progressBlock

    Progress block to call (optional).

    Return Value

    BFTask with a success result set to PFFileUploadResult containing the url and name of the uploaded file.