Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    521
    Plugin Contributions
    3

    Default Hard time insert an image name into a directory with my custom code ...

    I copied this bit from the same insert and other commands used to uplad the icons for the categories... but for some reason, the file is not being uploaded and the database is not being updated. Where did I go wrong with this?

    PHP Code:
              if ($_POST['featured_image_manual'] != '') {            // add image manually
                
    $featured_image_name zen_db_input("news_box/" $_POST['featured_image_manual']);
                
    $db->Execute("update " TABLE_BOX_NEWS "
                              set news_image = '" 
    $featured_image_name "'
                              where box_news_id = '" 
    . (int)$box_news_id "'");
              } else {
                if (
    $featured_news_image = new upload('featured_image')) {
                  
    $featured_news_image->set_destination(DIR_FS_CATALOG_IMAGES "news_box/");
                  if (
    $featured_news_image->parse() && $featured_news_image->save()) {
                    
    $featured_image_name zen_db_input("news_box/" $featured_news_image->filename);
                  }
                  if (
    $featured_news_image->filename != 'none' && $featured_news_image->filename != '' && $_POST['image_delete'] != 1) {
                    
    // save filename when not set to none and not blank
                    
    $db->Execute("update " TABLE_BOX_NEWS "
                                  set news_image = '" 
    $featured_image_name "'
                                  where box_news_id = '" 
    . (int)$box_news_id "'");
                  } else {
                    
    // remove filename when set to none and not blank
                    
    if ($featured_news_image->filename != '' || $_POST['image_delete'] == 1) {
                      
    $db->Execute("update " TABLE_BOX_NEWS "
                                    set news_image = 'Something here?'
                                    where box_news_id = '" 
    . (int)$box_news_id "'");
                    }
                  }
                }
              } 

  2. #2
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    521
    Plugin Contributions
    3

    Default Re: Hard time insert an image name into a directory...

    EDIT: The code seems to allow manual entry of filenames and the checkbox does work to clear out the name from the database. The only problem seems to be with the actual uploading.

 

 

Similar Threads

  1. v150 Insert xml code into rss feed on v1.5
    By Pretty dumb in forum General Questions
    Replies: 1
    Last Post: 26 Oct 2012, 01:27 PM
  2. insert code into module file
    By quick1 in forum General Questions
    Replies: 1
    Last Post: 5 May 2011, 03:40 AM
  3. hard code url into order confirmation email
    By gsdcypher in forum General Questions
    Replies: 0
    Last Post: 10 Dec 2010, 09:06 PM
  4. Replies: 1
    Last Post: 23 Apr 2010, 02:23 PM
  5. how do you randomise a image with php code insert
    By oavs in forum General Questions
    Replies: 6
    Last Post: 24 Jan 2007, 09:36 AM

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