0

I am working on a batch-script that makes a SQL query and saves it to a file. The file will then be handled by PHP. Is it possible to POST a file from Windows CMD to a PHP site so it can be handled by php with $_FILES['someFile']?

Daniel W.
  • 31,164
  • 13
  • 93
  • 151
XerXeX
  • 784
  • 4
  • 16
  • 1
    This question should be asked on [Software Recommendations SE](http://softwarerecs.stackexchange.com/) or [SuperUser](http://www.superuser.com) + there are already plenty of questions asking for the same: [How to download files from command line in Windows, like Wget is doing?](http://superuser.com/questions/25538/how-to-download-files-from-command-line-in-windows-like-wget-is-doing), [POST binary file with cmd line curl using headers contained in the file](http://stackoverflow.com/questions/4053937/post-binary-file-with-cmd-line-curl-using-headers-contained-in-the-file) – Daniel W. May 12 '16 at 10:38

2 Answers2

3

Yes, you can use curl for this.

curl -F someFile=@localfile.sql http://example.org/upload
Xyz
  • 5,955
  • 5
  • 40
  • 58
2

Or you can use wget.

wget --post-file=file.jpg http://yourdomain.com/target.php
Daniel W.
  • 31,164
  • 13
  • 93
  • 151