I have tried that but you can't assign a string as a filename, it gives an error that it has to be a character array.
A string IS a NULL terminated array of chars. A String, on the other hand, is an abomination. Which are you referring to in your snippets?
Also when i want to put the content from the .txt file in a string with
Well, it should be pretty obvious that that won't work. You can only assign ONE element of the array at a time.
byte index = 0;
while (FileName.available())
{
filename[index++] = FileName.read();
filename[index] = '\0';
}
Snippets-r-us is down the internet a ways. Post ALL of your code here, or go there, instead. Your choice.