Guest Posted June 9, 2005 Share Posted June 9, 2005 doesn't work at all. I can get it to upload, I can get it to pull a number, but it keeps assigning the newest number to the upload. With that said, it's not very helpful to upload files for order #58 and have them come up as order 63 huh? Here is the code, if needed. <?php /* $Id: conditions.php,v 1.22 2003/06/05 23:26:22 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_UPLOAD); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1"); $orders = tep_db_fetch_array($orders_query); $error = false; if (isset($HTTP_POST_VARS['orders_id']) && isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'upload')) { // perform upload $orders_id = tep_db_prepare_input($HTTP_POST_VARS['orders_id']); $reupload = tep_db_prepare_input($HTTP_POST_VARS['reupload']); $noinput = true; for($i=1; $noinput && ($i<=UPLOAD_NO); $i++) { //echo "<HR>infile$i=${"infile".$i}<HR>"; if(${"infile".$i}!="") $noinput=false; } if ( $noinput ) { $error = true; $messageStack->add('upload', "You did not specify any files to upload. Try again!"); } else { $slash = ( strstr( PHP_OS, "WIN") ? "\\" : "/" ); // make order subdirectory // COMMENTED OUT SUBDIR PER BCS !!! 2004-12-01 // if ( ! is_dir(DESTINATION . $slash . $orders_id)) { // if ( ! (mkdir(DESTINATION . $slash . $orders_id)) ) { // $error = true; // $messageStack->add('upload', "We had trouble storing your files. Please contact the webmaster!"); // } // } for($i=1; $i<=UPLOAD_NO; $i++) { $just=filesize(${"infile".$i}); $fp_size[i] = $just; // // WAS: got rid of orders_id subfolder... // copy ( ${"infile" . $i}, DESTINATION . $slash . $orders_id . $slash . $orders_id . "_" . ${"infile" . $i . "_name"} ) // if ( ( ${"infile".$i} != "" ) && copy ( ${"infile" . $i}, DESTINATION . $orders['orders_id'] . "aa_" . ${"infile" . $i . "_name"} ) && unlink ( ${"infile" . $i} ) ) { $messageStack->add('upload', "Processed file " . $i . " - " . ${"infile" . $i . "_name"} . " - " . $fp_size[i] . " bytes"); } else { // only raise error if ${"infile".$i} really has a value but could not be processed if ( ${"infile".$i} != "" ) { $error = true; $messageStack->add('upload', "Could not upload file " . $i . " - " . ${"infile" . $i . "_name"}); } } } if (!$error) { // success message // !!! BCS 2004-12-01 if success AND was a RE-UPLOAD (reupload<>0) then change status of order in database if ( $reupload == "1" ) { tep_db_query("update orders set orders_status = 1 where orders_id = " . $orders_id); } tep_redirect(tep_href_link(FILENAME_UPLOAD_SUCCESS, 'orders_id=' . ORDERS_ID . '&action=success')); } } } if ($messageStack->size('upload') > 0) { echo $messageStack->output('upload'); } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_UPLOAD)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <table id="Table_01" width="993" height="547" border="0" cellpadding="0" cellspacing="0"> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <tr> <td valign="top"><table id="columnleft" width="222" height="426" border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/index_20.jpg" width="40" height="100%" alt=""></td> <td width="151" height="384" bgcolor="#C5D0D9"><?php require(DIR_WS_INCLUDES . 'column_left.php'); ?></td> <td><img src="images/index_22.jpg" width="31" height="100%" alt=""></td> </tr> <tr> <td><img src="images/index_23.jpg" width="40" height="42" alt=""></td> <td><img src="images/index_24.jpg" width="151" height="42" alt=""></td> <td><img src="images/index_25.jpg" width="31" height="42" alt=""></td> </tr> </table></td> <td colspan="10" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE . $orders['orders_id'] . 'aa'; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_MAIN; ?><br> <form enctype='multipart/form-data' action="uploadfiles.php" method='post'> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="50000000"> <INPUT TYPE="hidden" name="action" value="upload"> <INPUT TYPE="hidden" name="orders_id" value="<?php echo ORDERS_ID ?>"> <INPUT TYPE="hidden" name="reupload" value="<?php echo $HTTP_GET_VARS['reupload'] ?>"> <table border="0" width="90%" align="center" cellspacing="0" cellpadding="0"> <tr> <td><input type="file" name="infile1" size="25"></td> <td> </td> <td> </td> <td> </td> <td><input type="file" name="infile4" size="25"></td> </tr> <tr> <td><input type="file" name="infile2" size="25"></td> <td> </td> <td> </td> <td> </td> <td><input type="file" name="infile5" size="25"></td> </tr> <tr> <td><input type="file" name="infile3" size="25"></td> <td> </td> <td> </td> <td> </td> <td><input type="file" name="infile6" size="25"></td> </tr> </table> <br> <br> <div align="center"> <input type="Submit" value=" Upload NOW "> </div> </form></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> </table></td> </tr> <tr> <td><img src="images/spacer.gif" width="222" height="1" alt=""></td> <td><img src="images/spacer.gif" width="36" height="1" alt=""></td> <td><img src="images/spacer.gif" width="94" height="1" alt=""></td> <td><img src="images/spacer.gif" width="101" height="1" alt=""></td> <td><img src="images/spacer.gif" width="55" height="1" alt=""></td> <td><img src="images/spacer.gif" width="52" height="1" alt=""></td> <td><img src="images/spacer.gif" width="110" height="1" alt=""></td> <td><img src="images/spacer.gif" width="104" height="1" alt=""></td> <td><img src="images/spacer.gif" width="14" height="1" alt=""></td> <td><img src="images/spacer.gif" width="178" height="1" alt=""></td> <td><img src="images/spacer.gif" width="27" height="1" alt=""></td> </tr> </table> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> I've tried replacing all instances of $orders['orders_id'] with $HTTP_GET_VARS['order_id'] and it will show the correct id but upload the wrong id. I'm working with another developers code, so I'm a bit lost for why he does things the way he does. Link to comment Share on other sites More sharing options...
Guest Posted June 11, 2005 Share Posted June 11, 2005 Nevermind. I have it working. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.