public UploadString ( string contents, string extension, bool hidden ) : DBFile | ||
contents | string | |
extension | string | |
hidden | bool | |
return | DBFile |
public DBFile UploadString (string contents, string extension, bool hidden)
{
string tmpfile = null;
try {
tmpfile = Path.GetTempFileName ();
File.WriteAllText (tmpfile, contents);
return Upload (tmpfile, extension, hidden, null);
} finally {
try {
File.Delete (tmpfile);
} catch (Exception ex) {
log.ErrorFormat ("Error while deleting temporary file: {0}", ex);
// ignore exceptions
}
}
}