I have to upload the file in my local system using the CURL HTTP POST in linux command line.
I have used these commands, with no success:
curl -F "image=@/var/www/fbapp/images/registration.png" http://localhost/xmlcreate/curlupload.php
curl --form "fileupload=@/var/www/fbapp/images/registration.png" http://localhost/xmlcreate/curlupload.php
curl -X POST -d @/var/www/fbapp/images/registration.png http://localhost/xmlcreate/curlupload.php
curl --data-binary @/var/www/fbapp/images/registration.png http://localhost/xmlcreate/curlupload.php
I used all these commands but none of these worked.
Here is my PHP file where I'm trying to get the uploaded file(using curl) and save it in some other directory:
<?php
$uploadpath = "images/";
$filedata = $_FILES['image']['tmp_name'];
$filename = $_POST['filename'];
if ($filedata != '' && $filename != '')
copy($filedata,$uploadpath.$filename);
?>
Can someone please help me with this. I'm stuck here and not able to go forward.
Once it starts working on the local I have to use the remote server URL, instead of the localhost.