Hello!
I have a custom drupal module which saves uploaded files passed from the uploadify jquery plugin. All seemed well but some images are coming up with grey blocks in them. See:
http://5oup.net/sites/default/files/360/5ouppic.jpg
This is a user submitted image and I'm unable to reproduce the problem myself - as I understand it it's a server side problem, but I'm unsure about how to rectify the issue.
Here is the PHP from my module which handles the upload:
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$filename = $_FILES['Filedata']['name'];
$filename = preg_replace("/[^A-Za-z0-9. ]/", '', $filename);
$filename = str_replace(" ", '_', $filename);
$targetFile = str_replace('//','/',$targetPath) . $filename;
$name = $filename;
mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
Is the upload 'stalling' somehow? Any ideas about why it would only be on some images and not others? Any help is very gratefully received!
James
EDIT - Able to reproduce problem
I have contacted a user and am able to recreate the problem (i.e. it uploads with grey pixels every time) using this jpeg:
http://5oup.net/test/sucon.jpg
This jpeg uploads fine:
I just can't figure out the difference?! What on earth could be going on?
Thanks