File Upload in Internet Explorer

So I know the post is here File upload howto which gives an answer, which works on Chrome and FireFox…I swear this was working fine until the 22/11/19 in IE as well, but now the solution:-

New-UDInput -Title "Stuff" -Content {
   New-UDInputField -Type binaryFile -Name file 
} -Endpoint {
   param($File)

   $fileStream = [IO.File]::Create($File.FileName)
   $stream = $File.OpenReadStream()
   $stream.CopyTo($fileStream)
   $fileStream.Dispose()
   $stream.Dispose()
}

No longer seems to work in IE, as in you get the RED error at the bottom of the screen either telling me the file is in use (when it is not) or it cannot find it…I swear this used to work, but now doesn’t :frowning: does anyone out there have another solution of getting a file copied to a location from the udinput?
I mean it does work, copies the file, but I get the error instead of a toast? But only in IE…so wondering if anyone else has a different approach as I tried but failed. Thanks

Hi @psDevUK senpai,

Is the powershell thingymabob throwing an error?
I’ve found that the old-fashioned filestream and whatnot tends to do that from time to time.
Take a look at the rest api file upload example and implement this instead as i believe set-content should be more forgiving. ( i believe binaryfile returns the file as bytearray? O:-))
https://docs.universaldashboard.io/rest-apis#uploading-files

1 Like

Man I do some dinny things…so I forgot I setup a GPO which added this site as a trusted site…this was so the managers could simply click a hyperlink to open the attachment from a modal window…as it had to be a trusted site for this to work…doh! It messed up the uploading…removed GPO problem went away…again was only happening in IE. But everyone is forced to use IE…So I have updated this incase anyone else has this issue…I’m sure there is some setting I could change butwasted so much time on this already :zipper_mouth_face: I was even looking at creating a custom component…

Wait what?

Did running UD in a trusted site actually break the file upload? :open_mouth:
How… what? :sweat_smile: classic IE

Yeah man exactly that, making this https dashboard a trusted site in IE broke the upload code example I posted in my initial post…Go figure…?
Sure there is one of those annoying tick boxes I could have ticked…but still it has been a great time spent trouble shooting this :roll_eyes:
I made it a trusted site so the hyperlinks to open the attachment worked…which it did…but in-turn it broke the file upload, by throwing that red error at the bottom of the screen…although it did work? But obviously was confusing end users to thinking it didn’t which I don’t blame them…on this one occasion every other time its the end-user to blame :rofl:

Well… that sounds fun :sweat_smile:
Thanks for sharing dude,

I’m hoping for a chromeful Christmas for you bro!