Loading a file into a PHP script using Curl and Bash scripting -


having foo.txt file, i'm trying load php script using curl , bash script.

foo.sh, foo.txtand foo.phpare under same folder:

/var/www/foo/ 

the foo.sh bash script:

#!/bin/bash curl --form "fileupload=@foo.txt" http://localhost/foo/foo.php 

the foo.php script:

<?php echo "foo line"; var_dump($_file); exit; 

when execute bash script:

./foo.sh 

the foo.php script shows foo line message, regarding file, gives following error message:

undefined variable: _file in /var/www/foo/foo.php on line 3 

any suggestions?

if there way load file $_file variable using php (via terminal), solve problem.

it $_files (so should add "s")

http://php.net/manual/en/reserved.variables.files.php


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -