Morning,
I'm wanting to story mutilple images on the same form, uploading them into a SQL Database, then allowing any users to view these images. Can someone help me?
Solved! Go to Solution.
Hi @Anonymous,
Could you please share a bit more about your scenario?
Could you please share a screenshot about your app's configuration?
Further, how do you store/upload multiple images on the same form within your app? Do you want to upload multiple images into your SQL table once time?
Currently, there is no direct way to upload multiple images into a SQL table once time wihtin PowerApps. As an alternative solution, you could consider take a try with the follownig workaround:
I have create a SQL Table on my side, the data structure as below:Note: The BlobData column is a Image type column in my SQL table. The FileName column is the Primary key in my SQL table. Please also make sure that there is primary key within your SQL table.
Collect(UploadPics,{Name:Now()&CountRows(UploadPics)&".jpg",Url:AddMediaButton1.Media})
ForAll(UploadPics,Patch('[dbo].[TestBlobUpload]',Defaults('[dbo].[TestBlobUpload]'),{FileName:Name,BlobData:Url}))
Please check and see if the following blog would help in your scenario:
https://powerapps.microsoft.com/en-us/blog/upload-files-from-powerapps-to-sql-server/
In addition, you could also consider take a try to add a Camera control (Camera1) instead of the Add picture control within your form, set the OnSelect property of the Camera control to following formula:
Collect(UploadPics,{Name:Now()&CountRows(UploadPics)&".jpg",Url:Camera1.Photo})
Set the OnSelect property of the "Upload into SQL Table" button to following formula:
ForAll(UploadPics,Patch('[dbo].[TestBlobUpload]',Defaults('[dbo].[TestBlobUpload]'),{FileName:Name,BlobData:Url}))
Best regards,
Kris
Hi @Anonymous,
Could you please share a bit more about your scenario?
Could you please share a screenshot about your app's configuration?
Further, how do you store/upload multiple images on the same form within your app? Do you want to upload multiple images into your SQL table once time?
Currently, there is no direct way to upload multiple images into a SQL table once time wihtin PowerApps. As an alternative solution, you could consider take a try with the follownig workaround:
I have create a SQL Table on my side, the data structure as below:Note: The BlobData column is a Image type column in my SQL table. The FileName column is the Primary key in my SQL table. Please also make sure that there is primary key within your SQL table.
Collect(UploadPics,{Name:Now()&CountRows(UploadPics)&".jpg",Url:AddMediaButton1.Media})
ForAll(UploadPics,Patch('[dbo].[TestBlobUpload]',Defaults('[dbo].[TestBlobUpload]'),{FileName:Name,BlobData:Url}))
Please check and see if the following blog would help in your scenario:
https://powerapps.microsoft.com/en-us/blog/upload-files-from-powerapps-to-sql-server/
In addition, you could also consider take a try to add a Camera control (Camera1) instead of the Add picture control within your form, set the OnSelect property of the Camera control to following formula:
Collect(UploadPics,{Name:Now()&CountRows(UploadPics)&".jpg",Url:Camera1.Photo})
Set the OnSelect property of the "Upload into SQL Table" button to following formula:
ForAll(UploadPics,Patch('[dbo].[TestBlobUpload]',Defaults('[dbo].[TestBlobUpload]'),{FileName:Name,BlobData:Url}))
Best regards,
Kris
Sorry Kris I've been away.
I've worked out how to do this, very similar to what you have shown.
Thanks for the help!
You may want to check out our new preview feature which allows the upload of multiple images to an entity and stores the files in blob file storage to reduce SQL size.
https://powerapps.microsoft.com/en-us/blog/public-preview-new-image-enhancements-available-via-api/
Hi while trying this steps, I am getting error of data mismatch while patch function. The cds column has datatype image but the collection uploadPic contains text value. I am using patch function in onsuccess of datacard to get the Id from submitForm. Is there any option to patch the image to cds.?
Error: The type of this argument does not match the expected type record. Found type 'Text'.
User | Count |
---|---|
177 | |
116 | |
85 | |
44 | |
41 |
User | Count |
---|---|
240 | |
153 | |
130 | |
77 | |
72 |