Anyone?
Homestead & uploading large files (L4.2)
I figured that seen as my other post was 'answered' then I would ask again.
Using Homestead and Laravel of course, I'm wanting to upload a CSV file more than 8MB in size, this doesn't happen. If i upload something smaller like 500KB or 1MB a PDF, Word Doc etc it works, but this 8MB+ CSV file doesn't.
I spoke to Taylor about this and he said I would need to change some settings in the php.ini file which I have done, still to no avail, so reaching out to the likes of @JeffreyWay and @bashy to give help/advice on this.
Here's both my form and controller method to do the upload.
Form:
{{ Form::open(['route' => 'books.upload', 'class' => 'form-horizontal', 'files' => true]) }}
<p>Upload CSV file</p>
{{ Form::file('file') }}
<button class="btn btn-success">Upload</button>
{{ Form::close() }}
Controller:
// CSV File upload of Books
public function upload()
{
if (Input::hasFile('file')) {
$file = Input::file('file');
$name = time() . '-' . $file->getClientOriginalName();
$moved = $file->move(public_path() . '/uploads/csv', $name);
$csv = new Reader($moved);
$csv->setOffset(0);
$nbInsert = $csv->each(function ($row) use (&$sth) {
DB::table('books')->insert(
array(
'ref' => (isset($row[0]) ? $row[0] : ''),
'date' => (isset($row[1]) ? $row[1] : ''),
'sold' => (isset($row[2]) ? $row[2] : ''),
'author' => (isset($row[3]) ? $row[3] : ''),
'title' => (isset($row[4]) ? $row[4] : ''),
'place_date' => (isset($row[5]) ? $row[5] : ''),
'description' => (isset($row[6]) ? $row[6] : ''),
'price' => (isset($row[7]) ? $row[7] : ''),
'keywords' => (isset($row[8]) ? $row[8] : ''),
'classification' => (isset($row[9]) ? $row[9] : ''),
'cost' => (isset($row[10]) ? $row[10] : ''),
'notes' => (isset($row[11]) ? $row[11] : ''),
'isbn' => (isset($row[12]) ? $row[12] : ''),
'publisher' => (isset($row[13]) ? $row[13] : ''),
'pub_date' => (isset($row[14]) ? $row[14] : ''),
'binding' => (isset($row[15]) ? $row[15] : ''),
'condition' => (isset($row[16]) ? $row[16] : '')
)
);
return true;
});
}
return Redirect::to('admin/books')->with('flash_success', 'Upload completed & new data inserted.');
}
Help/advice greatly appreciated.
That was for Nginx, nothing to do with PHP.
This is my PHP setup on one of my servers, this alows 100MB files uploaded.
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 100M
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 125M
Set post_max_size higher than upload_max_size. Sure I read somewhere it should be equal or higher than upload_max_filesize. Yours is 0, looking at the other thread.
Please or to participate in this conversation.