YePix Posted June 21, 2019 Posted June 21, 2019 Do you have any idea why the mp4 video files are not uploaded? What's wrong with this code? <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'insert': case 'save': if (isset($_GET['mID'])) $id = tep_db_prepare_input($_GET['mID']); $videoload_name = tep_db_prepare_input($_POST['video_name']); $videoload_status = tep_db_prepare_input($_POST['video_status']); $sql_data_array = array('video_name' => $videoload_name, 'status' => $videoload_status); $videoload_url = new upload('video_url'); $videoload_url->set_destination(DIR_FS_CATALOG_IMAGES . 'uploads/'); if ($action == 'insert') { $insert_sql_data = array('created_date' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); if ($videoload_url->parse() && $videoload_url->save()) { tep_db_perform(TABLE_FEATURED_VIDEO, $sql_data_array); $id = tep_db_insert_id(); tep_db_query("update " . TABLE_FEATURED_VIDEO . " set video_url = '" . tep_db_input($videoload_url->filename) . "' where id = '" . (int)$id . "'"); } }elseif ($action == 'save') { tep_db_perform(TABLE_FEATURED_VIDEO, $sql_data_array, 'update', "id = '" . (int)$id . "'"); if ($videoload_url->parse() && $videoload_url->save()) { tep_db_query("update " . TABLE_FEATURED_VIDEO . " set video_url = '" . tep_db_input($videoload_url->filename) . "' where id = '" . (int)$id . "'"); } } tep_redirect(tep_href_link('featured_video.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $id)); break; case 'deleteconfirm': $id = tep_db_prepare_input($_GET['mID']); if (isset($_POST['delete_video']) && ($_POST['delete_video'] == 'on')) { $video_query = tep_db_query("select video_url from " . TABLE_FEATURED_VIDEO . " where id = '" . (int)$id . "'"); $video = tep_db_fetch_array($video_query); $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_IMAGES . 'uploads/' . $video['video_url']; if (file_exists($image_location)) @unlink($image_location); } tep_db_query("delete from " . TABLE_FEATURED_VIDEO . " where id = '" . (int)$id . "'"); tep_redirect(tep_href_link('featured_video.php', 'page=' . $_GET['page'])); break; case 'setflag': if (isset($_GET['mID'])) $id = tep_db_prepare_input($_GET['mID']); tep_db_query("UPDATE " . TABLE_FEATURED_VIDEO . " SET status=" . $_GET['flag'] . " WHERE id=" . $id); tep_redirect(tep_href_link('featured_video.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $id)); break; } } require('includes/template_top.php'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_VIDEOS; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php $videoload_query_raw = "select m.id, m.video_name, m.video_url, m.created_date, m.status from " . TABLE_FEATURED_VIDEO . " m order by m.id"; $videoload_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $videoload_query_raw, $videoload_query_numrows); $videoload_query = tep_db_query($videoload_query_raw); while ($videoload = tep_db_fetch_array($videoload_query)) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $videoload['id']))) && !isset($vInfo) && (substr($action, 0, 3) != 'new')) { $vInfo = new objectInfo($videoload); } if (isset($vInfo) && is_object($vInfo) && ($videoload['id'] == $vInfo->id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $videoload['id'] . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $videoload['id']) . '\'">' . "\n"; } ?> <td class="dataTableContent"><?php echo $videoload['video_name']; ?></td> <td class="dataTableContent"> <?php if ($videoload['status'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', 'Active', 10, 10) . ' <a href="' . tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $videoload['id'] . '&action=setflag&flag=0') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $videoload['id'] . '&action=setflag&flag=1') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', 'Set Active', 10, 10) . '</a> ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', 'Inactive', 10, 10); } ?> </td> <td class="dataTableContent" align="right"><?php if (isset($vInfo) && is_object($vInfo) && ($videoload['id'] == $vInfo->id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $videoload['id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php echo $videoload_split->display_count($videoload_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_VIDEOS); ?></td> <td class="smallText" align="right"><?php echo $videoload_split->display_links($videoload_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> </tr> </table></td> </tr> <?php if (empty($action)) { ?> <tr> <td align="right" colspan="3" class="smallText"><?php echo tep_draw_button(IMAGE_INSERT, 'plus', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id . '&action=new')); ?></td> </tr> <?php } ?> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'new': $heading[] = array('text' => '<strong>' . TEXT_HEADING_NEW_MANUFACTURER . '</strong>'); $contents = array('form' => tep_draw_form('featured_video', 'featured_video.php', 'action=insert', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '<br />' . TEXT_VIDEO_NAME . '<br />' . tep_draw_input_field('video_name')); $contents[] = array('text' => '<br />' . TEXT_VIDEO_IMAGE . '<br />' . tep_draw_file_field('video_url')); $videoload_status_string = tep_draw_radio_field('video_status', '1', true ) . TEXT_YES . ' ' . tep_draw_radio_field('video_status', '0') . TEXT_NO; $contents[] = array('text' => '<br />' . TEXT_VIDEO_STATUS . $videoload_status_string); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']))); break; case 'edit': $heading[] = array('text' => '<strong>' . TEXT_HEADING_EDIT_MANUFACTURER . '</strong>'); $contents = array('form' => tep_draw_form('featured_video', 'featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '<br />' . TEXT_VIDEO_NAME . '<br />' . tep_draw_input_field('video_name', $vInfo->video_name)); $contents[] = array('text' => '<br />' . TEXT_VIDEO_IMAGE . '<br />' . tep_draw_file_field('video_url') . '<br />' . $vInfo->video_url); $videoload_status_string = tep_draw_radio_field('video_status', '1', ($vInfo-> status == '1' ? true : false) ) . TEXT_YES . ' ' . tep_draw_radio_field('video_status', '0', ($vInfo-> status == '0' ? true : false)) . TEXT_NO; $contents[] = array('text' => '<br />' . TEXT_VIDEO_STATUS . $videoload_status_string); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id))); break; case 'delete': $heading[] = array('text' => '<strong>' . TEXT_HEADING_DELETE_MANUFACTURER . '</strong>'); $contents = array('form' => tep_draw_form('featured_video', 'featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '<br /><strong>' . $vInfo->video_name . '</strong>'); $contents[] = array('text' => '<br />' . tep_draw_checkbox_field('delete_video', '', true) . ' ' . TEXT_DELETE_IMAGE); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id))); break; default: if (isset($vInfo) && is_object($vInfo)) { $heading[] = array('text' => '<strong>' . $vInfo->video_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id . '&action=edit')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('featured_video.php', 'page=' . $_GET['page'] . '&mID=' . $vInfo->id . '&action=delete'))); $contents[] = array('text' => '<br />' . TEXT_DATE_ADDED . ' ' . tep_date_short($vInfo->created_date)); $contents[] = array('text' => '<br />' . TEXT_VIDEO_NAME . ' ' . $vInfo->video_name); $contents[] = array('text' => '<br />' . TEXT_VIDEO_STATUS . ' ' . ($vInfo->status == '1' ? IMAGE_ICON_STATUS_GREEN : IMAGE_ICON_STATUS_RED) . '<br /><br />'); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table></td> </tr> </table> <?php require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?>
Jack_mcs Posted June 21, 2019 Posted June 21, 2019 Without knowing what the error is it is difficult to say. But generally speaking, video files are usually large so they may be higher than the servers upload size (probably 2 MB). You might want to check with your host regarding that. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Recommended Posts
Archived
This topic is now archived and is closed to further replies.