Fix the issue of not uploading scaled versions of the images

Depending on the WP settings ("Organize my uploads into month- and year-based folders"), the $data['file'] in this function is either "2013/10/IMG.JPG", or plain "IMG.JPG".

The current implementation works only with the month/year folder structure, because the regex does not match to file names without a path, and upload() is then called with $file parameter like "IMG.JPG/IMG-200x200.JPG", which is not correct.

(line 528) This patch changes the matching so that $filepath gets correctly initialized: the first (.+/)? part matches everything up to the first "/", and is optional. In case of plain folder structure, the preg_replace returns an empty string, and in case of month/year structure, it returns "2013/10/", for example.

(line 530) In this case, the $filepath has always a trailing "/".

I have tested this with WP 3.6.1.