All of the text, filenames etc are uploaded to the database and the thumbnail is accurately loaded into the appropriate directory..
But...
I get this error:
SplFileInfo::getSize(): stat failed for C:\wamp64\tmp\phpA213.tmp(1/1) RuntimeExceptionSplFileInfo::getSize(): stat failed for C:\wamp64\tmp\phpA213.tmpin RequestContext.php line 52at SplFileInfo->getSize()in RequestContext.php line 52at RequestContext->Facade\FlareClient\Context\{closure}(object(UploadedFile))at array_map(object(Closure), array('thumbnail' => object(UploadedFile)))in RequestContext.php line 41at RequestContext->mapFiles(array('thumbnail' => object(UploadedFile)))in RequestContext.php line 36at RequestContext->getFiles()in RequestContext.php line 95at RequestContext->getRequestData()in RequestContext.php line 103at RequestContext->toArray()in LaravelRequestContext.php line 64at LaravelRequestContext->toArray()in Report.php line 211at Report->allContext()in AnonymizeIp.php line 11at AnonymizeIp->handle(object(Report), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Report))in AddGlows.php line 24at AddGlows->handle(object(Report), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Report))in Pipeline.php line 105at Pipeline->then(object(Closure))in Flare.php line 203at Flare->applyMiddlewareToReport(object(Report))in Flare.php line 179at Flare->createReport(object(ViewException))in ErrorPageHandler.php line 39at ErrorPageHandler->handle(object(ViewException))in IgnitionWhoopsHandler.php line 25at IgnitionWhoopsHandler->handle(object(ViewException))in Run.php line 321at Run->handleException(object(ViewException))in Handler.php line 345at Handler->renderExceptionWithWhoops(object(ViewException))in Handler.php line 324at Handler->renderExceptionContent(object(ViewException))in Handler.php line 308at Handler->convertExceptionToResponse(object(ViewException))in Handler.php line 287at Handler->prepareResponse(object(Request), object(ViewException))in Handler.php line 192at Handler->render(object(Request), object(ViewException))in Handler.php line 49at Handler->render(object(Request), object(ViewException))in Pipeline.php line 51at Pipeline->handleException(object(Request), object(ViewException))in Pipeline.php line 132at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in CheckRole.php line 23at CheckRole->handle(object(Request), object(Closure), ' admin')in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in SubstituteBindings.php line 41at SubstituteBindings->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in VerifyCsrfToken.php line 76at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in ShareErrorsFromSession.php line 49at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in StartSession.php line 56at StartSession->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in AddQueuedCookiesToResponse.php line 37at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in EncryptCookies.php line 66at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php line 105at Pipeline->then(object(Closure))in Router.php line 682at Router->runRouteWithinStack(object(Route), object(Request))in Router.php line 657at Router->runRoute(object(Request), object(Route))in Router.php line 623at Router->dispatchToRoute(object(Request))in Router.php line 612at Router->dispatch(object(Request))in Kernel.php line 176at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))in Pipeline.php line 130at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in TransformsRequest.php line 21at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in TransformsRequest.php line 21at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in ValidatePostSize.php line 27at ValidatePostSize->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in CheckForMaintenanceMode.php line 62at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in TrustProxies.php line 57at TrustProxies->handle(object(Request), object(Closure))in Pipeline.php line 171at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php line 105at Pipeline->then(object(Closure))in Kernel.php line 151at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php line 116at Kernel->handle(object(Request))in index.php line 55
If I refresh the page, the error goes away and I get an alert that that the filenam is already taken. And that's because everything was added and uploaded correctly..
So why am I getting this error?
Here's my Request file:
<?phpnamespace App\Http\Requests;use Illuminate\Foundation\Http\FormRequest;class VideoRequest extends FormRequest{ /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ // 'title' => 'required', 'filename' =>'required | unique:videos', 'description' => 'required' ]; } public function messages() { return [ 'title is.required' => 'title is required!', 'filename is.required' => 'don\'t forget to include your video file!', 'descirption is.required' => 'be sure to include the description' ]; }}
Not entirely sure what's going on, but that error indicates that somewhere in your code, it's trying to get the size of the file that's been uploaded (the temp file), but because you've moved it, it no longer exists, so it can't get the size.
You may also want to check your php.ini and see what the upload_max_filesize is set to (you might be exceeding that).
Bruce Gust
ASKER
Chris!
I did check the upload size settings and I'm gold, so I know that's not an issue.
As far as the "movement" of the uploaded file, is there a sequence of events that I need to be sensitive to?
At what point is the system attempting to get the size of the file? I'm just following my nose with all this, but I'm dropping the ball somewhere...
Chris Stanyon
Hey Bruce,
Bit of a baffling one. I've just replicated your code (as much as I can see) and it works exactly as it should - no warnings / exceptions. I can't see where it's trying to get the file size, so if you're not explicitly asking for it, maybe something behind the scenes is requesting it.
Time to go full debug mode - start off by commenting out the $file->move line. If the error stops, uncomment it and then try just dumping the $movie object:
We'll need to figure out which line is triggering the getSize() call. Also, is there anything in your Video model or Views that could potentially be the problem.
Out of interest, what version of Laravel are you running.
I changed the order so the "move" happened before I attempted to store it.
Why would that make a differrence?
Chris Stanyon
Hmmm. Logically, it shouldn't make a difference. Possibly a bug in the version of Laravel you're using (you haven't said which version), or perhaps you have some additional code / trait in your Video Model. As it stands, by reversing those lines, it would appear that this line:
$movie->thumbnail=$thumbnail;
is calling the getSize() method, but that in itself is just setting a property to a string value (unless your Model has additional functionality)
If you're using a version of Laravel later than 5.5 (I tihnk), then you shouldn't really be using the move() method. You should be using the store() method instead. Not sure if that's related.
Bruce Gust
ASKER
I'm pretty certain I'm running Laravel 6. I'll check when I get home later this afternoon.
Not entirely sure what's going on, but that error indicates that somewhere in your code, it's trying to get the size of the file that's been uploaded (the temp file), but because you've moved it, it no longer exists, so it can't get the size.
You may also want to check your php.ini and see what the upload_max_filesize is set to (you might be exceeding that).