Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,688
    Plugin Contributions
    9

    Default is admin/includes/classes/upload.php correct?

    i am getting the following error:

    PHP Warning: is_uploaded_file() expects parameter 1 to be string, object given.

    i am getting in the aforementioned script. the code is as follows:

    Code:
        function parse() {
          global $messageStack;
    
          if (isset($_FILES[$this->file])) {
            $file = array('name' => $_FILES[$this->file]['name'],
                          'type' => $_FILES[$this->file]['type'],
                          'size' => $_FILES[$this->file]['size'],
                          'tmp_name' => $_FILES[$this->file]['tmp_name']);
          } elseif (isset($GLOBALS['HTTP_POST_FILES'][$this->file])) {
            global $HTTP_POST_FILES;
    
            $file = array('name' => $HTTP_POST_FILES[$this->file]['name'],
                          'type' => $HTTP_POST_FILES[$this->file]['type'],
                          'size' => $HTTP_POST_FILES[$this->file]['size'],
                          'tmp_name' => $HTTP_POST_FILES[$this->file]['tmp_name']);
          } else {
            $file = array('name' => (isset($GLOBALS[$this->file . '_name']) ? $GLOBALS[$this->file . '_name'] : ''),
                          'type' => (isset($GLOBALS[$this->file . '_type']) ? $GLOBALS[$this->file . '_type'] : ''),
                          'size' => (isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : ''),
                          'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : ''));
          }
    
          if ( zen_not_null($file['tmp_name']) && ($file['tmp_name'] != 'none') && is_uploaded_file($file['tmp_name']) ) {
    the error happens on the last line.

    i have tracked this error down to only happen when the if statement hits the last block. and therefore the line in question is:

    Code:
    'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : ''));
    does that look correct?

    its getting called by admin/includes/modules/new_product_preview.php

    unfortunately i can not reproduce the error at will, as it's rather confusing as to when we would hit that 3rd block of code. i have tried with a numerous things in the image file.

    any ideas?

    thanks.

    ps, at the time of the error, $file['tmp_name'] looks like:

    Code:
           (
               [file] => products_image
               [filename] => 
               [destination] => /home/XXXXXX/XXXXXXX/images/
               [permissions] => 420
               [extensions] => Array
                   (
                       [0] => jpg
                       [1] => jpeg
                       [2] => gif
                       [3] => png
                       [4] => webp
                       [5] => flv
                       [6] => webm
                       [7] => ogg
                   )
           
               [tmp_filename] => 
               [message_location] => direct
           )
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: is admin/includes/classes/upload.php correct?

    I'm guessing that's only triggered when NOT uploading a product image?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,688
    Plugin Contributions
    9

    Default Re: is admin/includes/classes/upload.php correct?

    dr b,
    i have not been able to reproduce the error. i put some hooks into the code to come up with the info in my first post. but one of my clients is doing the product maintenance and he has not reported any problems to me, so i am only seeing errors after the fact.

    my guess is that, yes, when NOT uploading a product image. but again i have not been able to reproduce it... and i have tried.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 10 Mar 2013, 11:11 PM
  2. Replies: 0
    Last Post: 17 May 2011, 04:30 PM
  3. Version help with admin/includes/classes/order.php
    By Brent in forum General Questions
    Replies: 2
    Last Post: 4 Jan 2011, 03:25 PM
  4. Replies: 8
    Last Post: 6 Jan 2010, 02:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR