In the first place, you should learn what ‘DocumentRoot’ means, and what the difference between URLs and file paths is.
Your DocumentRoot for the front-end app is probably ‘/some-dir/some-sub-dir/yii2/frontend/web’. This directory serves as the base URL for the front-end app that is ‘http://your.domain.com/frontend/web’.
And your DocumentRoot for the back-end app is ‘/some-dir/some-sub-dir/yii2/backend/web’. This directory serves as the base URL for the back-end app that is ‘http://your.domain.com/backend/web’.
Note that the directory ‘/some-dir/some-sub-dir/yii2/common/img’ can not be represented as a valid URL for the front-end app, because it is not under the DocumentRoot of the front-end app.
And also note that the directory ‘/some-dir/some-sub-dir/yii2/frontend/web/public/img’ can be accessed from the server-side PHP of your back-end app, while the URL ‘http://your.domain.com/frontend/web/public/img’ might not be accessed from the users of the back-end app. So you can store the uploaded files in the directory that can be accessed from the front-end app users.