Solved

Check on size upload files


Userlevel 3
Badge +11

Hi all,

Does anyone know how to check the filesize of a file which is uploaded as document.
Many company’s still have a restriction on the file size of an attachment to be sent to them.
I want to give a warning if the filesize exceeds a specific limit?

 

icon

Best answer by Edwin Saan 8 June 2022, 11:23

View original

This topic has been closed for comments

4 replies

Userlevel 5
Badge +16

SQL server has built-in function to read directory contents and show files and their sizes. 

select * from sys.dm_os_enumerate_filesystem('C:\Thinkwise\GUI','*')

 

Userlevel 3
Badge +11

Thanks, I will try this.

Userlevel 3
Badge +11

When I do a file upload I cannot use the dm_os_enumerate_filesystem because the GUI is changing the path of the file directly into the ‘to-be-upload’ path.

My file upload has a file location. That’s mandatory on creating the domain.

The @file_upload field is directing to the new path. Not to the path I upload the file from. Since the file is not actually moved yet I cannot use the dm_os_enumerate because the file is not there yet!

I cannot retrieve the path where the file is uploaded from out of the form @parameters. 

Ha any one a suggeston how to fix this?

Userlevel 3
Badge +11

I don’t know why but apparently the file_upload is checking the path from… So I’m now able to check the filesize when uploading a file