How to add file in root of a sharepoint web application?

SharePoint folder structures are different, generally pages will be available in Page library. What if a user wants to add a file in root of SharePoint web application.

Generally sitemap and robots files are added to root.
Below is the powershell command which can add file to root location.

$fileBytes = [system.io.file]::ReadAllBytes("D:\MyFolder\sitemap.xml");
$site = Get-SPSite "http://server:80";
$site.RootWeb.Files.Add("sitemap.xml", $fileBytes, $true);

Comments

Popular

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX

What is Cloud Computing - A guide for beginners