New-UDUpload is not working for .zip files

Just wondering if you’ve had an opportunity to get back to this, the size limitation seems to still exist on 2.1.2

I’ll knock the priority up on this. It hasn’t been resolved.

1 Like

Any update on this? I just tried again on 2.3.1 and still seem to have the same issue

Hey @adam - We upgraded to 2.4.1 last week hoping this issue would be resolved, but I think there is another bug in the upload method.

I noticed this issue in the github issues, New-UDUpload does not work properly in UDForm · Issue #628 · ironmansoftware/issues (github.com)
But I think it might be a bigger problem, at least for us. We had been testing the upload inside a UDForm, nested inside a tab in a dashboard. We just tried again in a new dashboard without tabs, or even the form and there isn’t any information being added to the body. The only way I seem to be able to get any information about the upload is referencing the ID of the upload like this:

New-UDDashboard -Title "Hello, World!" -Content {
    New-UDUpload -Id 'MyUpload' -Text 'Upload1' -OnUpload {
        Show-UDToast (Get-UDElement -Id 'MyUpload') -Duration 2500
    }
}

Am I missing something obvious?

I just tried this on 2.4.1 and it works:

New-UDDashboard -Title "Hello, World!" -Content {
    New-UDUpload -Id 'MyUpload' -Text 'Upload1' -OnUpload {
        Show-UDToast $Body.Data -Duration 2500
        Show-UDToast $Body.FIleName -Duration 2500
        Show-UDToast $Body.Name -Duration 2500
        Show-UDToast $Body.ContentType -Duration 2500
    }
}

You should also be able to use $Body.RawData to access the byte[] contents of the file directly. What looks like isn’t being set properly is $EventData.

This is also displaying a pop up for me.

Show-UDToast ($Body | ConvertFrom-Json)
1 Like

Interesting, I put that exact code in my test dashboard and still got errors, here’s what was in the log.

Nov 2, 2021 1:45 PM An error occurred: Cannot bind argument to parameter 'Message' because it is an empty string.
Endpoint: MyUpload
Session: 10ef99f8-5a9c-418a-9c76-a0356b83dfd7
File: 
Endpoint Start Line: 2
Endpoint End Line: 8
Stack Trace: at <ScriptBlock>, <No file>: line 2

I set my log level to debug, but don’t see any errors, lots of HTTP 200 codes, and occasionally a warning about CORS:

2021-11-02 13:52:16.329 -03:00 [INF] CORS policy execution failed.

Hmmm. That is very weird. Just to be 100% sure, you have the framework set to latest?

Yep, I had to double-check that too.
I’m linking an excerpt from our log with debug on.

debuglog2 - Pastebin.com

I’m having the same issue as Stuart I believe. If I use the latest Framework, the upload fails. It looks like the New-UDUpload function isn’t returning any data within $Data . If I switch the Framework to 3.5.0 It works. The caveat to 3.5.0 is that there is no progress bar but the uploads eventually do go through.

working example with latest framework

Show-UDModal -Content {

                            New-UDUpload -Text 'Upload File' -OnUpload { 
                    
                                $bytes = [System.Convert]::FromBase64String($Body.Data)
                                [System.IO.File]::WriteAllBytes("$TaskPath\$($Body.Name)", $bytes)
                    
                                if (Test-Path -Path "$TaskPath\$($Body.Name)") {
                    
                                    Show-UDToast -Message "File Uploaded!" -MessageColor Green -Title $($Body.Name) -Position topCenter -Duration 2500
                     
                                    Start-Sleep -Seconds 3
                     
                                    Hide-UDModal
                     
                                }

I’m getting on a call with @StuartA today because it seems like it works in some environments and not others so hopefully we can figure out what the difference is.

1 Like

Just dropping some more info that we gleaned today.

@StuartA is running PSU as a Windows Service as a service account with Windows Auth enabled. We tracked down that files are indeed getting uploaded to the temp directory for the service account: C:\users\service.account\appdata\local\temp

I have configured my PSU environment to use Windows Auth and a Windows Service and that doesn’t reproduce it and will be setting up a service account to see if that does. EDIT: Setting my service using a service account doesn’t cause the issue either

It seems like what is happening is the file is being uploaded but then the reference to the file is never being included in the endpoint so $body is $null. Trying to track down where it’s failing. Will add some additional logging and continue to try to reproduce.

1 Like

This has to do with using the integrated environment. It’s been sorted and a fix will be available in 2.5. If you use the integrated environment, files will fail to upload. Switching to a non-integrated environment will work.

1 Like

2.4.2 build is available here with this fix: https://imsreleases.z19.web.core.windows.net/

Looks good Adam, thanks for sorting! What is the max file size limit for this? I tried a 2gb file and the progress bar halts during upload and file isn’t moved.

Hmmm let me check. It should support whatever size.

Max allowed size is 2 GB. We’ll have to implement server streaming to enable uploads beyond that limit. I’ll open an issue for it.

This is looking good on my end.

Thanks Adam

1 Like

Great, can you share the url for the issue so I can subscribe? thanks once again, aside from the limit it works perfectly.

Issue is here: Enable uploads of over 2 GB · Issue #666 · ironmansoftware/issues · GitHub