Closed David-Mueller closed 11 years ago
By default, auto processing is on in the configuration. This was already the case in previous versions.
This means that if you call Upload::process() yourself, you're processing the uploaded files twice. In previous versions that was not a problem, as data was stored in arrays and a second run would just overwrite the first one.
The new 2.0 package is object oriented, and creates File objects for every file uploaded. A second run in this case just creates a new set of objects causing this behaviour.
So, if you intend to process manually, make sure auto_process is set to false in your config.
I'll add a new ticket for this on the fuelphp/upload repo to see if we can come up with duplicate file detection.
Post Request Payload: ------WebKitFormBoundaryezAqIWuSA9jSxbUA Content-Disposition: form-data; name="avatar"; filename="IMG_4139.jpg" Content-Type: image/jpeg
...
controller Code:
As a result, I see "2_17ca58b02b927f968e1c610aadf6371e_1.jpg" (empty file) and "2_17ca58b02b927f968e1c610aadf6371e.jpg" (the image).
I found that static::$upload->getAllFiles() returns two identical files.