PFFileUploadController

@protocol PFFileUploadController <NSObject>

A policy interface for overriding the default upload behavior of uploading a PFFile 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:(BFCancellationToken *_Nonnull)cancellationToken
           progressBlock:(PFProgressBlock _Nonnull)progressBlock;

    Swift

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

    Parameters

    sourceFilePath

    Path to the file to upload.

    fileName

    The PFFile’s fileName.

    mimeType

    The PFFile’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.