Reputation: 31225
I'm writing a Artisan command to do batch image uploads to the application.
Trying to look for the equivalent command to do the following
$file = Input::file('photo');
Becaues I'm in the command line the Input class doesn't work.
I tried File::get('/path/to/file')
but it didn't return the same object.
Upvotes: 0
Views: 2165
Reputation: 87769
Input::file()
will only receive files via form POST:
<form method="POST" enctype='multipart/form-data' action="index.php">
<input type=file name=upload>
<input type=submit name=press value="OK">
</form>
What means that you cannot use Input::file()
unless you are doing something like this to test your upload
curl --form upload=/path/to/file http://your/site/url/upload
If you are trying to send files via command, like
php artisan upload /path/to/file
You'll need to get this filename, read the file from disk and do whatever you need to do with it.
Upvotes: 4