is there a way to upload a file and have it saved in a folder like for example a button called upload once clicked the user will be prompted with explore page to select a file/files and once the files selected it will uploaded to a folder on the server.
ok it’s been a long day for me…I’m thinking of implementing this in a dashboard I am building right now…so you need to define something like:-
$Root = $PSScriptRoot
$Init = New-UDEndpointInitialization -Variable “Root”
at the top of your script, then include the endpointinitialization when you start the dash board…this will then allow you to output to $Root the current path the script is being run from…iif you look at @adamdriscoll new video he kindly uploaded https://www.youtube.com/watch?v=6nPGEIFqlXw and get to 40:53 you will see an example of uploading a file and the code needed in new-udinputfield -type file… will upload my example once I built it…hopefully this puts you on the right track
@psDevUk thank you so much for the link. in fact i was able to accomplish the task except i need to retain the uploaded file name and extension but could not find a way to pass the full name into my out-file command.
Hi @wsl2001 glad the link was helpful. I haven’t got round to this yet, but I am sure after the variable you can use .attribute or .value to get the value of the filetype box. Then use this to copy or move that file…I’m out most of today but sure I will be scripting on my Sunday evening so will update once I got a working version
Thinking quickly about it, just use a get-member on the variable for the filetype endpoint variable then you will see all the properties you could use to achieve this
Thanks again, I’ll try your solution and I’ll be waiting also for an example script if you get to pull the full file name with it’s extension so it will help others looking for the same solution in this forum.
ok so I just been playing about with this for the first time, and I didn’t realise it read the whole file you are trying to upload and plonks that in the outfile.txt not the file path I was hoping…doh! So for PNG files you end up with a load of gibberish in a txt file. So I know its a cop out but thinking of just a normal input field for the user to type path to file name, you could then validate that and then copy the file or do what ever with it, with using the $Session hope this makes sense as late here.
@Adam is there a way to get the file name from new-udinputfield, i saw that react is doing reader.readastext which makes the file string contains the uploaded file data.