You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/01/29 12:16:54 UTC

[GitHub] [cordova-plugin-file] 08Thug commented on issue #346: File Path Issue in iOS 13.1

08Thug commented on issue #346: File Path Issue in iOS 13.1
URL: https://github.com/apache/cordova-plugin-file/issues/346#issuecomment-579729876
 
 
   Well the problem is with the apache cordova camera plugin it provides the temporary path to the video file to come out from this error implement below changes in camera plugin.
   
   in CDVCamera.m change THIS:
   
   (CDVPluginResult*)resultForVideo:(NSDictionary*)info
   {
   NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString];
   return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
   }
   to THIS:
   
   (CDVPluginResult*)resultForVideo:(NSDictionary*)info
   {
   NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
   
   NSArray* spliteArray = [moviePath componentsSeparatedByString: @"/"];
   NSString* lastString = [spliteArray lastObject];
   NSError *error;
   NSFileManager *fileManager = [NSFileManager defaultManager];
   NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp"];
   NSString *filePath = [documentsDirectory stringByAppendingPathComponent:lastString];
   [fileManager copyItemAtPath:moviePath toPath:filePath error:&error];
   
   return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
   }
   Hope it will help you.
   
   And ofcourse you should perform this also
   
    if (this.platform.is('android')) {
       filePath = 'file:///' + this.uploadForm.controls['file'].value;
     } else {
       filePath = this.uploadForm.controls['file'].value;
     }

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org