https://segmentfault.com/a/1190000009674814
Link above article has been written by a very good, clear, do not be explained here.
Added: When performing
UploadedFile-> saveAs ($ file) This method of time, $ file address this argument can not be /upload/xxx/xx.jpg only upload / xxx / xx.jpg is not put in front of the slash / \