Connecting Tech Pros Worldwide Forums | Help | Site Map

Uploading images

Newbie
 
Join Date: Oct 2006
Posts: 1
#1: Oct 20 '06
Hi guys,

I would appreciate very much any help that anybody can give me with the following problem I have.

I am trying to upload images using PHP move_uploaded_file, but for some reason the files don't get uploaded. This code has been used before and worked great, but not now. When I try to debug it shows that it reads the file name, creates the new file name and etc, but when it comes to uploading it fails. Doesn't show any error, just the variable that holds the result it's empty. Here is the code I've used:

if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;

if(!isset($_FILES['filProdSImg']))
$sError["filProdSImg"] = "An image was not found.";

$sImageName = basename($_FILES['filProdSImg']['name']);

if(empty($sImageName))
$sError["sImageName"] = "The name of the image was not found.";

if(empty($sError))
{
$extension = explode ('.', $_FILES['filProdSImg']['name']);
$filename = $vcarid .'-s.'. $extension[1];
$filename = strtolower($filename);

$newSImage = "../products/" . $filename;
$varSImg=$newSImage;
$sResult = @move_uploaded_file($_FILES['filProdSImg']['tmp_name'], $newSImage);

if(empty($sResult))
{
$title.="";
}else{
$title.="/Thumbnail image";
}





More code follows to upload another image. Very similar to the above code.

I get a bit stuck at the moment as I can't see what's wrong (especially when it has worked before).

Thanks a lot

Liz

Reply