[PHP] Moving uploaded image tmp file problem

2004-10-20 Thread Dave Grant
Hello, I wonder if someone has ran into a problem similar to or related to 
this before.

I have a rather large form that, among other things, allows the user to 
upload 2 images, one small, the other slighly larger.  They upload just 
fine, they show up in the $_FILES array, and I do error checking on them 
which seems to pass.

Then I move them with the following code:

$thumbPath = $GLOBALS[dvdimgpath].$_POST[gameId]._thumb.jpg;
$fullPath = $GLOBALS[dvdimgpath].$_POST[gameId]._full.jpg;
if ($DEBUG) echo Thumb image uploaded to .$thumbPath.br /\n;
if (!move_uploaded_file($_FILES[thumbImage][tmp_name], $thumbPath)) {
echo Image file could not moved to the images dir.  Please try 
again;
}
if ($DEBUG) echo Full image uploaded to .$fullPath.br /\n;
if (!move_uploaded_file($_FILES[fullImage][tmp_name], $fullPath)) {
echo Image file could not moved to the images dir.  Please try 
again;
}

The images are not there when I go to look for them in the destination 
directory.  Any suggestions or ideas?  Thanks. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image upload not working correctly

2004-10-14 Thread Dave Grant
Thanks for the reponse.  Yes, the destination paths look fine and the PHP 
error log displays no errors.  Any other ideas?

Thanks.


Jason Wong [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Thursday 14 October 2004 02:40, Dave Grant wrote:

 echo Thumb image uploaded to .$thumbPath.br /\n;
 echo Full image uploaded to .$fullPath.br /\n;

 Do these look OK?

 Everything works fine, except that the images are simply not there when 
 we
 go look for them.  The best explanation I can come up with is that they 
 are
 not moved, but I have no idea why.  I've done this with no problem on my
 personal site.  Is it a problem with the move_uploaded_file function? 
 Any
 ideas?

 What does the PHP error log say?

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Faith goes out through the window when beauty comes in at the door.
 */ 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image upload not working correctly

2004-10-14 Thread Dave Grant
Just to clarify, everything looks like it works fine except for moving the 
images to the destination path.  The images upload, the server recognizes 
them, but they don't get moved to the destination path.

Thanks.


Jason Wong [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Thursday 14 October 2004 02:40, Dave Grant wrote:

 echo Thumb image uploaded to .$thumbPath.br /\n;
 echo Full image uploaded to .$fullPath.br /\n;

 Do these look OK?

 Everything works fine, except that the images are simply not there when 
 we
 go look for them.  The best explanation I can come up with is that they 
 are
 not moved, but I have no idea why.  I've done this with no problem on my
 personal site.  Is it a problem with the move_uploaded_file function? 
 Any
 ideas?

 What does the PHP error log say?

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Faith goes out through the window when beauty comes in at the door.
 */ 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Image upload not working correctly

2004-10-13 Thread Dave Grant
Hello.  I am working on a rather large form for my work that accepts, among 
other things, 2 images, one smaller one 65 x 93 pixels, and a larger one 105 
x 150 pixels, both in JPG format.  Let me run through the whole process, 
showing my code.

I use simple, standard HTML for the form:

input type=file name=thumbImage size=15
input type=file name=fullImage size=15

I check the $_FILES array to make sure the server uploads the images:

array(2) {
  [thumbImage]=
  array(5) {
[name]=
string(15) DAK01_thumb.jpg
[type]=
string(11) image/pjpeg
[tmp_name]=
string(14) /tmp/phpXxmX1s
[error]=
int(0)
[size]=
int(7161)
  }
  [fullImage]=
  array(5) {
[name]=
string(14) DAK01_full.jpg
[type]=
string(11) image/pjpeg
[tmp_name]=
string(14) /tmp/php05LOkc
[error]=
int(0)
[size]=
int(12235)
  }
}


I do the following error checking for various things:

// Small Thumbnail Image
 if (trim($_FILES[thumbImage][tmp_name])) {
  if ($_FILES[thumbImage][size]  10240) {
   $formVars[results] .= The small photo must be 10240 bytes or lessbr 
/;
  }
  if ($_FILES[thumbImage][type] != image/pjpeg  
$_FILES[thumbImage][type] != image/jpeg) {
   $formVars[results] .= The small photo must be in .jpg formatbr /;
  }
  $imgSize = getimagesize($_FILES[thumbImage][tmp_name]);
  if ($imgSize[0]  65) {
   $formVars[results] .= The small photo must be 65 pixels wide or 
lessbr /;
  }
 }
 // Full Image
 if (trim($_FILES[fullImage][tmp_name])) {
  if ($_FILES[fullImage][size]  20480) {
   $formVars[results] .= The large photo must be 20480 bytes or lessbr 
/;
  }
  if ($_FILES[fullImage][type] != image/pjpeg  
$_FILES[fullImage][type] != image/jpeg) {
   $formVars[results] .= The large photo must be in .jpg formatbr /;
  }
  $imgSize = getimagesize($_FILES[fullImage][tmp_name]);
  if ($imgSize[0]  105) {
   $formVars[results] .= The large photo must be 105 pixels wide or 
lessbr /;
  }
 }

Then, I move the temp image files:

// Copy image to $GLOBALS[dvdimgpath].$_POST[gameId]._[thumb/full].jpg
  $thumbPath = $GLOBALS[dvdimgpath].$_POST[gameId]._thumb.jpg;
  $fullPath = $GLOBALS[dvdimgpath].$_POST[gameId]._full.jpg;
  echo Thumb image uploaded to .$thumbPath.br /\n;
  if (!move_uploaded_file($_FILES[thumbImage][tmp_name], $thumbPath)) {
   $formVars[results] .= Image file could not moved to the images dir. 
Please try again;
  }
  echo Full image uploaded to .$fullPath.br /\n;
  if (!move_uploaded_file($_FILES[fullImage][tmp_name], $fullPath)) {
   $formVars[results] .= Image file could not moved to the images dir. 
Please try again;
  }

Everything works fine, except that the images are simply not there when we 
go look for them.  The best explanation I can come up with is that they are 
not moved, but I have no idea why.  I've done this with no problem on my 
personal site.  Is it a problem with the move_uploaded_file function?  Any 
ideas?

Thanks! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php