I am trying to upload a file and an image using the google drive api example for iOS.
It’s easy to upload text and image separately but I can’t figure out how to upload both.
How do you combine an image and text?
If I do this:
NSData *fileContent = [self.textView.text dataUsingEncoding:NSUTF8StringEncoding];
NSData *imageData = UIImagePNGRepresentation(self.someImage.image);
NSMutableData *uploadData = [NSMutableData dataWithData:fileContent];
[uploadData appendData:imageData];
uploadParameters = [GTLUploadParameters uploadParametersWithData:uploadData MIMEType:@"multipart/related"];
It will upload both but I can’t view it on my drive.
Do I have to create a google doc?
If so, what is the format of a google doc?
I create a doc on my drive and added some text and image to it so that works, so google docs can definitely handle text and images in the same file.
I searched for Google doc format but nothing comes up there either (if this is the right approach).
If you’re trying to upload a formatted document that contains both text & images, that is considered a single file and must be uploaded that way. There isn’t a way to directly upload in the native Google Docs format, but you can use one of the other supported formats like DOCX, PDF, etc and convert them.