Reputation: 2405
In a App. i am saving the images from server in Document Directory.
In Database that images are came as "image4_12:19:27.png"
in documents directory folder that images stored as "image4_12/19/27.png"
How that image convert "image4_12:19:27.png" to "image4_12/19/27.png" in Document Directory.
What should i do?
Upvotes: 0
Views: 155
Reputation: 44633
You can split the file name into parts separated by :
and then later append them.
NSString * fileName = @"image4_12:19:27.png";
NSArray * components = [fileName componentsSeparatedByString:@":"];
NSString * relativeFilePath = [components componentsJoinedByString:@"/"];
NSString * absoluteFilePath = [documentsDirectory stringByAppendingPathComponent:components];
where documentsDirectory
is the path to the documents directory.
Upvotes: 3