Polaris
Polaris copied to clipboard
Support for file upload/download
It would be quite handy to have some simple built in support for file download and upload
So, download and upload are of course built-in to httplistener but are we talking about built-in to the directory browser for static files from a directory or just documentation on how to do it?
Yes, it will be good if we have a option to download files like
Import-Module Polaris -Verbose
New-PolarisStaticRoute -RoutePath "/MyFile" -FolderPath "./downloads"
New-PolarisGetRoute -Path "/" -ScriptBlock {
$Response.Send("Hello World!")
}
Start-Polaris -Port 1337
Start-Process "chrome.exe" "http://localhost:1337"
So, users can place a link or button to download the file
PS C:\> http://localhost:1337/MyFile/File1.Json
To get this working - I made a minor change in the New-PolarisStaticRoute cmdlet like illustrated below
$Response.Headers.Add('Content-Disposition', "attachment;filename=$($RequestedItem.Name)")
$Response.SetStream(
[System.IO.File]::OpenRead($RequestedItem.FullName)
)
@TylerLeonhardt @Tiberriver256 - Let me know your input