Seems like this might be the issue:
$import = new OrderFileImport($request->all());
try except the file:
$import = new OrderFileImport($request->except('file'));
and are you passing the request data anyway since you are not using that at all?
i am trying to import an excel using laravel excel package and trying to use the queue feature for that like below :
$import = new OrderFileImport($request->all());
$import->Sheets('Sheet1');
Excel::queueImport($import,$request->file('file'));
return redirect()->back();
and then in my FirstSheetImport i am doing like below :
class FirstSheetImport implements ToModel,WithStartRow,WithChunkReading,ShouldQueue
{
private $request;
public function __construct(array $request)
{
$this->request = $request;
}
/**
* @param array $row
*/
public function model(array $row)
{
return new Order([
'id' => (string) Str::orderedUuid(),
'shop_id' => 6696,
]);
}
public function startRow(): int
{
return 2;
}
public function chunkSize(): int
{
return 100;
}
public function batchSize(): int
{
return 100;
}
}
but when i send the request i get the error below :
Serialization of 'Illuminate\Http\UploadedFile' is not allowed
i read over the net that its because i dont upload the file and sending it to job is not possible , but i saw it in storage/framework/laravel-excel its generating the temp files there .
thanks in advance
i have changed my controller to upload the file first and then pass it to queueimport like below :
$import = new OrderFileImport($request->all());
$fileName = uniqid().'.xlsx';
$request->file('file')->move(storage_path('/excels'),$fileName);
$import->Sheets('Sheet1');
Excel::queueImport($import,storage_path('excels/'.$fileName));
return redirect()->back();
but yet again the i got the same error :
Serialization of 'Illuminate\Http\UploadedFile' is not allowed
Seems like this might be the issue:
$import = new OrderFileImport($request->all());
try except the file:
$import = new OrderFileImport($request->except('file'));
and are you passing the request data anyway since you are not using that at all?
Please or to participate in this conversation.