When attempting to convert a file by passing the file upload object Symfony\Component\HttpFoundation\File\UploadedFile, the conversion fails with bad request.
I did some digging into it, and it seems there are multiple issues. Firstly, in the ConvertLocalFile class if its an instance of UploadedFile you run $this->setFile($file->getFilename());. This only gives the filename and not the path on disk. I believe it should be set to $this->setFile($file->getPathname());.
This still doesn't solve the issue of setting the file extension as getPathname returns a temporary path which doesn't contain the extension. I tried adding $this->setFormat($file->getClientOriginalExtension()); under where you set the filename and this seemed to solve the first issue.
However, later is still fails with 400 "Bad Request". If I visit the process url it gives back a json object including the error "File not found (Upload failed)".
Hi,
When attempting to convert a file by passing the file upload object
Symfony\Component\HttpFoundation\File\UploadedFile
, the conversion fails with bad request.I did some digging into it, and it seems there are multiple issues. Firstly, in the
ConvertLocalFile
class if its an instance ofUploadedFile
you run$this->setFile($file->getFilename());
. This only gives the filename and not the path on disk. I believe it should be set to$this->setFile($file->getPathname());
.This still doesn't solve the issue of setting the file extension as
getPathname
returns a temporary path which doesn't contain the extension. I tried adding$this->setFormat($file->getClientOriginalExtension());
under where you set the filename and this seemed to solve the first issue.However, later is still fails with 400 "Bad Request". If I visit the process url it gives back a json object including the error "File not found (Upload failed)".
I am unsure how to solve this.
The changes I made are: