File uploading fails with current master #130
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: aheathershaw/blue-twilight#130
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It seems you recently made a change to involve some processing queue in the file uploads, but now I believe this means that the queue moves away the image file from its original
/tmp
location, which causes subsequent code to fail.In terms of the code:
I believe the file is now at
$queuedFileName
, but theFile
instance still uses$photoFile
. Changing that to$queuedFileName
seems obvious and lets the upload POST request actually return 200, but still shows an "upload failed" error message and a trace in the laravel log.Here's the (what I think is the relevant part of) the backtrace of the original error:
When "fixing" the error as suggested above, it changes to:
I have not investigated further, I guess I'll stick with a released version instead.
Yeah this change is part of the upcoming 2.2.0 beta.
It allows for the analysis of uploaded photos to be shifted off to a separate server, using a Storage location as the temporary queue (which can then be accessed by both servers) instead of the previously hard-coded local file system.
The File instance still uses the $photoFile not the $queuedFilename as this is the temp file still on disk from the upload. In the case of a cloud storage queue (eg. Amazon S3) the $queuedFilename would be the path on a remotely-stored service where we couldn’t (as easily) get the file size and MIME type.
What I think is happening is that with the Amazon S3 driver, the image is COPIED from the uploaded temp folder to S3, so we still have the temp file to play with.
However the local storage driver (the default that should mirror current behaviour) MOVES the temp file into the analysis queue location, so it no longer exists to play with afterward.
This is the offending line.
This needs changing to be a copy, not a move. There doesn’t seem to be a Symfony or base PHP copy method on the File object so this will probably need to use the global “copy” function.
Yeah, I found that. Your analysis seems correct, and if you've been testing with the S3 backend, that also explains why it didn't show up before :-)