I cannot POST a php form with two files in powershell
I search the equivalent of the bash command : /usr/bin/curl -F fichier1=@/path_to_file1 -F fichier2=@/path_to_file2\MyUrl.com
The Php form "formulaire" wait two parameters : "fichier1" type file and "fichier2" type file
I've tried to follow the resolution of What is the right way to POST multipart/form-data using curl? but i have the error message A parameter cannot be found that matches parameter name 'F' I've tried to use the Invoke-Method with -Infile parameter but it accepts only one string parameter and I can't pass my two files path Hère is my code :
$Uri = "//MyUrl.com/backups/uploadLogsVms.php"
$filePath="C:\backup_points.csv"
$filePath2="C:\PROTECTED_VMS_JOB_SCHEDULE_2018_12_10.csv"
curl -v -F fichier1=@"$filePath" -F fichier2=@"$filePath2"
I expected to fill the form below and press the button boutEnvoyer with a powershell script:
<body>
<form name='formulaire' id='formulaire' method='post' action='/backups/uploadLogsVms.php' enctype='multipart/form-data'>
<input type='file' name='fichier1' id='fichier' size='60' /><br />
<input type='file' name='fichier2' id='fichier' size='60' /><br />
<input type='submit' class='bouton' id='boutEnvoyer' value='Envoyer' />
</form>
</body></html>
witch is equivalent to my bash command /usr/bin/curl -F fichier1=@/path_to_file1 -F fichier2=@/path_to_file2 http://MyUrl.com/backups/uploadLogs.php