I use Uploadifive to upload big files. That's working fine, except for Firefox on Android. When selecting an uploadfile from Google Drive, that file is first downloaded to the tablet and then uploaded using uploadifive. But Firefox is renaming this filename; and puts in tmp_ before and some numbers behind the filename. So, if test-1.mp3 is my filename; i get tmp_20950-test-1-5487457458.mp3.
I don't think i can overcome the renaming done by Firefox. But i can rename it via the script. So far i can remove the 'tmp_', but not the numbers. There could be 4 or 5 numbers in the start, or 8 or 10 numbers in the end.
if (preg_match('/tmp_/',$destination_file)){
$destination_file = str_replace('tmp_','',$destination_file);
}
So i search for commands to clear those numbers. The difficulty is not knowing how many numbers to clear. The only 'fixed' element is the stripe '-' after and before the number. Maybe can i use that in my command ? But don't know how.
You can try something like this pattern to get the filename:
/^tmp_\d+-(.*?)-\d+\.(.*?)$/
the first match will be the filename and the second the extension.regex tester