cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
holdusback
Frequent Visitor

HTML form (not microsoft) with file to sharepoint

Hey there,

 

First time posting after search for multiple days. 

 

So I have an HTML form (contact form 7) on a WordPress website, my need is to create a folder, a txt file inside WITH the files from the form into my sharepoint.

 

For now with an ajax call I can create a JSON file, send it to my flow and everything work, he creates a folder, a TXT file with all the string info from the form.

 

My only need is how I can send the 2 file from my form to this folder ? Cause the flow trigger's is a HTTP request, and he want only a json file, I cant send file through this. I have every time an error 400 when I try to send json and file.

 

So my question is how I can send those 2 files into the freshly created folder ?


Hope someone can help me,

 

Have a wonderful day

 

 

7 REPLIES 7
fchopo
Super User
Super User

Hi @holdusback 

Probably you'll need a couple of flows. For instance:

* Flow 1: Get the data in JSON format (triggered whit an HTTP Post request).

* Flow 2: Store the file in a FTP Server or send it to an email address.

Could it work?

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
holdusback
Frequent Visitor

Thanks for your answer !

 

 

So it's not possible to send via HTTP request file ? I think for security reason microsoft dont allow that ...

So the only way I have is to send all data info via mail, strike a flow when an email is received and upload everything on sharepoint ?

 

Was thinking that the email thing was another step that I can avoid by triggering the flow with http request but if it's the only way ...

Paulie78
Super User
Super User

I use WP-Forms on my Wordpress site and it is able to base64 encode the file attachments and then send them into a HTTP Flow. Does contact form 7 have similar options? You can still do it the way you are attempting by using the multipart body I think, but I dont have experience with it.

Hey Paulie,

 

Do you mean you succeed to send via HTTP request your file directly to sharepoint ?

For now, I've tried with an ajax call via jQuery, and it don't work. I will buy Gravity Form (a famous plugin for wordpress) I hope I can fix this, if not I will have to set up things by mail... Don't find it's a good solution but if it's the only one ...


I will updated this topic cause I need this for my company, so will have to find a way to do this

holdusback
Frequent Visitor

Still looking for a solution for this. Will put it here If I found one

Paulie78
Super User
Super User

Yes, I can do it with WP-Forms via HTTP (or via email) easily. I am sure contact form 7 can do the same (but I don't know). 

 

Even your current method should work (JSON and a file post). The problem is that this will create a multipart message, but you can extract the json and files separately with Power Automate.

holdusback
Frequent Visitor

You are right I succeeded at creating a file. I parse the encoded base64 to json, decode it with compose in the flow, create a file in sharepoint. Thanks to this : https://powerusers.microsoft.com/t5/Building-Flows/Is-there-a-way-to-convert-Base64-string-to-image-...

Last thing to sort it out is to find the extension type, jpg, png, pdf...

Cause in the create file of sharepoint he want a filename, Im sure there is a way/fonction to detect the file extention to put it in the filename. 

 

For now it create the file but without any extention ahah.



EDIT : Think I'll just make it easier : get the file extension via PHP and add the value in my json schema... Look like it is easier than in the flow directly... if someone have a solution directly in Microsoft flow to find the extension file from a base64 string, let me know ! 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,244)