Getting this error when uploading file to server
Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_0011.MOV” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/var/mobile/Media/DCIM/100APPLE/IMG_0011.MOV, NSUnderlyingError=0x13b157510 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
My code for converting path to NSDATA is:
let videoURL = User.sharedInstance.arrRoomGalleryVideos.objectAtIndex(index) as? NSURL
var movieData: NSData?
do {
let video = try NSData(contentsOfURL: videoURL!, options: .DataReadingMappedIfSafe)
// print("video", video)
multipartFormData.appendBodyPart(data: video, name: "video_path[]", fileName: strVidName, mimeType: "mp4/.mov")
} catch {
print(error)
return
}