I want to prevent users from being able to upload files if they are 0KB. I know there is a MaxAttachmentSize property on the attachments control but not seeing anything for minimum.
When accessing the most recently added attachment in the control, it seems I can only access the Value and Name properties of the attachment, not seeing anything for size. Example:
Last(AttachmentsControl.Attachments).Name
Is there any way to access the size of each attachment?
Solved! Go to Solution.
Hi @Cooper01 ,
It seems that it can only upload the file to the attachment column first, then automatically obtain the size of the file, and finally decide whether to keep the file or delete the file based on the size.
Because in your app, users upload local files.
If you have many files in the sharepoint library(in cloud), you could decide whether to move them to the attachment column according to their size. This can avoid completing the upload action.
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Hi @Cooper01 ,
If you want to detect the size of the attachment first, then decide whether to upload the attachment based on the size, it may be difficult to achieve.
I suggest you change the way to achieve a similar effect.
Firstly, the user uploads the attachments.
Secondly, the operation triggers the flow, which detects the size of the attachments.
Finally, if the size of the attachment is 0KB, delete it.
I did a test for you:
1\ Build an instant flow
Get attachments Id: Ask in Powerapps
Get attachment content Id : Ask in powerapps
Compose Inputs: div(int(length(string(outputs('Get_attachment_content')?['body']))),1024) // If the file size is less than 1KB, delete the attachment.
2\ Add the flow to the onselect property of the submit button in the canvas app.
Add set the onselect property of the submit button to:
SubmitForm(EditForm1);TEST19.Run(EditForm1.LastSubmit.ID,EditForm1.LastSubmit.ID)
// EditForm1 is the name of my edit form control. TEST19 is the name of my flow.
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Appreciate the response but I'm looking for a way to detect the side before the file makes it to SharePoint from the control or Power App. This will really slow down the process as uploading the file is only one part of a multi step form.
Hi @Cooper01 ,
At present, this may be difficult to achieve.
Logically, a local file needs to be uploaded to get its file size.
This step is to upload the file to the attachment column of the cloud list.
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Just looking for clarification you say it's difficult but is it at all possible without completing the upload action?
Hi @Cooper01 ,
It seems that it can only upload the file to the attachment column first, then automatically obtain the size of the file, and finally decide whether to keep the file or delete the file based on the size.
Because in your app, users upload local files.
If you have many files in the sharepoint library(in cloud), you could decide whether to move them to the attachment column according to their size. This can avoid completing the upload action.
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.
Did you miss the call?? Check out the Power Apps Community Call here!
User | Count |
---|---|
256 | |
203 | |
75 | |
37 | |
31 |
User | Count |
---|---|
338 | |
214 | |
119 | |
71 | |
55 |