Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add to Cart throws Warning: unlink(images/temp/.)


clatms

Recommended Posts

Hi I need help. When the Add to Cart button is clicked (OSC v2.2 RC2), it throws this error message:

Warning: unlink(images/temp/.) [function.unlink]: Is a directory in /home/public_html/includes/application_top.php on line 380

Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/includes/application_top.php:380) in /home/public_html/includes/functions/general.php on line 33

 

It's worked before (testing before I went live) but at some point I messed it up. I did make minor edits since going live. I restored all of the pre-live files, but I still get the error. The Option Type contribution worked pre-live so I'm pretty sure it's not the contribution - just looking for general troubleshooting help here. Thanks!

 

So in the application_top.php file, line 380 is "unlink(TMP_DIR . $file);" (see context below). Any and all advice appreciated!

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

//BOF - Zappo - Option Types v2 - File uploading: Purge the Temporary Upload Dir

$purgeDir = opendir(TMP_DIR) or die ('Could not open '.TMP_DIR);

while ($file = readdir($purgeDir)) {

if ($file != ('.htaccess') && filemtime(TMP_DIR . $file) < strtotime(OPTIONS_TYPE_PURGETIME)) {

unlink(TMP_DIR . $file); // Delete file from server...

tep_db_query("delete from " . TABLE_FILES_UPLOADED . " where files_uploaded_name = '" . $file . "'"); // Remove File's database entry....

}

}

closedir($purgeDir);

//EOF - Zappo - Option Types v2 - File uploading: Purge the Temporary Upload Dir

Link to comment
Share on other sites

You could change this:

 

  unlink(TMP_DIR . $file); // Delete file from server...

To:

 

  if ( ! is_dir( TMP_DIR . $file) )
unlink(TMP_DIR . $file); // Delete file from server...

I think that would work.

 

BACKUP THE FILE BEFORE EDITING!!!

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

You could change this:

 

  unlink(TMP_DIR . $file); // Delete file from server...

To:

 

  if ( ! is_dir( TMP_DIR . $file) )
unlink(TMP_DIR . $file); // Delete file from server...

I think that would work.

 

BACKUP THE FILE BEFORE EDITING!!!

 

Yay that worked!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...