Amanda,
You need to look at some of the error messages that are available to you:

1) remove the prepended @ from the file functions. This will tell what is
going wrong with the file copy.
>      if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) {
>          echo "Copy failed.";

2) use mysql_error() when you sql query fails rather than just die() ing
>    $add_image_query .= "UPDATE apt_company_t set
>company_logo_path='$photo_path', ";
>    $add_image_query .= "WHERE company_cd = $company_id[0]";
>    mysql_query($add_image_query) or die("Update Failed!");

As Curt Zirzow has suggested, it looks to me like your mysql syntax is at
fault here. mysql_error() will have told you about it.  You have a ', '
where you shouldn't have one....

Martin

----- Original Message -----
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Amanda McComb" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 3:43 PM
Subject: Re: [PHP] uploading a file from a form


> Everything is in the manual:
> http://www.php.net/features.file-upload
>
> Amanda McComb wrote:
>
> > I'm not sure what that means...how do I use it, and where?
> >
> > On Fri, 25 Jul 2003, Marek Kilimajer wrote:
> >
> >
> >>Don't you need to use $HTTP_POST_FILES array because you have
> >>register_globals off?
> >>
> >>Amanda McComb wrote:
> >>
> >>
> >>>I am having a problem with uploading a file from a form.  I changed the
> >>>permission on the directory, but I am still getting an error.  Here is
my
> >>>error:
> >>>
> >>>Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed!
> >>>
> >>>It looks like it's not finding the file type.  Here is my code:
> >>>
> >>><? include("../includes/database.php"); ?>
> >>><?
> >>>$long_path = "/home/vencel/www/images/apt/";
> >>>$short_path = "../images/apt/";
> >>>
> >>>if (($REQUEST_METHOD=='POST')) {
> >>>   for(reset($HTTP_POST_VARS);
> >>>                      $key=key($HTTP_POST_VARS);
> >>>                      next($HTTP_POST_VARS)) {
> >>>         $this = addslashes($HTTP_POST_VARS[$key]);
> >>>         $this = strtr($this, ">", " ");
> >>>         $this = strtr($this, "<", " ");
> >>>         $this = strtr($this, "|", " ");
> >>>         $$key = $this;
> >>>   }
> >>>
> >>>
> >>>//Check for form fields, insert them.
> >>>
> >>>//Pull out the id auto-incremented from previous insert.
> >>>
> >>>
> >>>//Check to see if a full-sized photo was uploaded
> >>> if ($photo == "none") {
> >>>    echo "No photo.";
> >>>    } else {
> >>>      $end = strrchr($photo_name, ".");
> >>>echo $end;
> >>>      $new_photo_name = $company_id[0] . $end;
> >>>
> >>>      if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) {
> >>>          echo "Copy failed.";
> >>>          echo $long_path . "company_logo/" . $photo_name;
> >>>echo $new_photo_name;
> >>>
> >>>      } else {
> >>>        $long_photo_path = $long_path . "company_logo/" .
$new_photo_name;
> >>>        $photo_path = $short_path . "company_logo/" . $new_photo_name;
> >>>
> >>>        if ([EMAIL PROTECTED]($long_path . "logo/" . $photo_name,
> >>>           $long_photo_path)){
> >>>           echo "Full sized photo not renamed.";
> >>>        }
> >>>      }
> >>>    }
> >>>    $add_image_query .= "UPDATE apt_company_t set
> >>>company_logo_path='$photo_path', ";
> >>>    $add_image_query .= "WHERE company_cd = $company_id[0]";
> >>>
> >>>    mysql_query($add_image_query) or die("Update Failed!");
> >>>
> >>>
> >>>    }
> >>>} ?>
> >>><FORM METHOD="post" ACTION=<? echo $PHP_SELF ?>>
> >>><table>
> >>><TR>
> >>><td colspan = 2><B>Use the <i>Browse</i> button to locate your file on
> >>>your computer or local network.</B></td></tr>
> >>>
> >>><tr>
> >>><td>Company Logo File:      </td><td><input type="file" name="photo"
> >>>size="30"></td></tr>
> >>>
> >>><tr>
> >>><td colspan=2 align=center><INPUT TYPE="submit" VALUE="Add"></td>
> >>></tr>
> >>></table>
> >>></FORM>
> >>>
> >>>Any ideas?
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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

Reply via email to