www.webdeveloper.com
Results 1 to 3 of 3

Thread: Error Message: Your file is too big to upload!!!

  1. #1
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Smile Error Message: Your file is too big to upload!!!

    Every time i try to upload an image file I get this error message. I basically can't upload anything anymore. I've made the images very small too and still nothing. =(


    [PHP]<?

    ob_start();

    //error_reporting(E_ALL);

    require("admin_utils.php");

    require("../includes/functions.php");



    if( isset( $_POST['mode'] ) && $_POST['mode']=='add' )

    disphtml("add_color_image();");

    else if( isset( $_POST['Submit'] ) && $_POST['Submit'] )

    {

    if($_POST['nextHiddenIndex']>$_POST['countHiddenIndex'])

    {

    $countImageIndex=$_POST['nextHiddenIndex'];

    }

    else

    {

    $countImageIndex=$_POST['countHiddenIndex'];

    }

    $upload_dir='../productImages/';

    //print_r($_FILES);

    //exit();

    for($i=0;$i<$countImageIndex;$i++){

    $temp_error = $_FILES['ph_image'.$i]['error'];

    if($temp_error == 0)

    {

    if($_FILES['ph_image'.$i]['name']!="")

    {

    $file_name = "";

    $file_name = time().'_'.$_SESSION['user_id'].'_'.$_FILES['ph_image'.$i]['name'];

    if(preg_match("/#/",$file_name))

    $file_name=preg_replace("/#/","",$file_name);

    $tmp_name = $_FILES['ph_image'.$i]['tmp_name'];

    $file_size = $_FILES['ph_image'.$i]['size'];

    $file_type = 'image';




    $sql = '';

    $check1 = fileUpload($upload_dir,$file_name,$tmp_name,$file_size,$file_type,$sql="");

    if($check1 != 0)//check1 returns 0 on success

    {

    $file_name='';

    $GLOBALS['err_msg']="Your file is too big to upload!!!";

    disphtml("add_color_image();");

    exit();

    //NA--->not available

    }

    //MakeThumbnail($upload_dir, $file_name ,500,'','big_thumbnail/big_thumb_');

    MakeThumbnail($upload_dir, $file_name ,100,'');



    $sql_gallery="insert into ".TABLE_PRODUCT_IMAGE_MASTER." set

    product_id='".$_POST['product_id']."',

    image_name='$file_name',

    is_active='Y'";

    $res=mysql_query($sql_gallery) or die("ERROR IN GALLERY IMAGE INSERT");

    }

    }

    else

    {

    $i--;

    $GLOBALS['err_msg']="Your last file is too big to upload!!!";

    disphtml("main();");

    exit();

    }

    }



    if($res>0)

    {

    $GLOBALS['err_msg']=$i;

    if($i>1)

    $GLOBALS['err_msg'].=" images";

    else

    $GLOBALS['err_msg'].=" image";

    $GLOBALS['err_msg'].=" successfully inserted ";

    }

    else

    $GLOBALS['err_msg']="Insert image not successful";



    disphtml("main();");

    }

    else if($_POST['mode']=='edit_default')

    {

    //$rsDefault=getValue(TABLE_PRODUCT_IMAGE_MASTER,$_POST['image_id'],'image_id','default_image');

    $rsProduct_id=getValue(TABLE_PRODUCT_IMAGE_MASTER,$_POST['image_id'],'image_id','product_id');

    $sqlDefaultZero="update ".TABLE_PRODUCT_IMAGE_MASTER." set default_image='0' where product_id='".$rsProduct_id."'";

    $rsDefaultZero=mysql_query($sqlDefaultZero);

    if($rsDefaultZero)

    {

    $sqlDefault="update ".TABLE_PRODUCT_IMAGE_MASTER." set default_image='1' where image_id='".$_POST['image_id']."'";

    $exeDefault=mysql_query($sqlDefault);

    }

    if($exeDefault)

    $GLOBALS['err_msg']="select default image successful";

    else

    $GLOBALS['err_msg']="select default image not successful";

    disphtml("main();");

    }

    else if($_POST['mode']=='delete')

    {

    $upload_dir='../productImages/';

    $image = trim(getValue(TABLE_PRODUCT_IMAGE_MASTER,$_POST['image_id'], 'image_id', 'image_name'));

    $unlink_image = $upload_dir.$image;

    if($image != "" && file_exists($unlink_image))

    {

    unlink($unlink_image);

    }



    //unlink big thumbnail image

    /*$unlink_big_thumb_image = $upload_dir."big_thumbnail/big_thumb_".$image;

    if($image !="" && file_exists($unlink_big_thumb_image))

    {

    unlink($unlink_big_thumb_image);

    }*/

    //unlink small thumnail image



    $thumb_image = 'thumb_'.$image;

    $unlink_thumb_image = $upload_dir."thumbnail/thumb_".$image;

    if($image !="" && file_exists($unlink_thumb_image))

    {

    unlink($unlink_thumb_image);

    }

    $qery=mysql_query("delete from ".TABLE_PRODUCT_IMAGE_MASTER." where image_id='".$_POST['image_id']."'");

    if($qery)

    $GLOBALS['err_msg']="Deletion successful";

    else

    $GLOBALS['err_msg']="Deletion not successful";

    disphtml("main();");

    }

    else

    disphtml("main();");

    function main()

    {

    $sqlProductImage="select * from ".TABLE_PRODUCT_IMAGE_MASTER." where product_id='".$_REQUEST['product_id']."'";

    $exeProductImage=mysql_query($sqlProductImage);

    $count=mysql_num_rows($exeProductImage);

    ?>

    <script language="JavaScript">

    function add_image()

    {

    document.frmGallery.mode.value='add';

    document.frmGallery.action="manageProductImage.php?<?=$_SERVER['QUERY_STRING']?>";

    document.frmGallery.submit();

    }

    function edit_default(record_id)

    {



    document.frmGallery.image_id.value=record_id;

    document.frmGallery.mode.value='edit_default';

    document.frmGallery.submit();

    }

    function delete_gallery(record_id)

    {

    var UserResp= window.confirm('Are you sure remove this image?');

    if(UserResp==true)

    {

    document.frmGallery.image_id.value=record_id;

    document.frmGallery.mode.value='delete';

    document.frmGallery.submit();

    }

    }

    </script>

    <form name="frmGallery" method="post" action="<?=$_SERVER['PHP_SELF']?>?<?=$_SERVER['QUERY_STRING']?>">

    <input type="hidden" name="mode">

    <input type="hidden" name="image_id">

    <input type="hidden" name="product_id" value="<?php if ( isset( $_REQUEST['product_id'] ) ) echo $_REQUEST['product_id']; ?>">

    <table width="99&#37;" align="center" style="BORDER: #DAE3F4 1px solid;" cellpadding="5" cellspacing="2">

    <tr class="TDHEAD" bgcolor="#799BE1" style="color:#ffffff">

    <td colspan="2" align="left">Product Image</td>

    </tr>

    <tr>

    <td align="center" class="ERR"><strong><?php if ( isset( $GLOBALS['err_msg'] ) ) echo $GLOBALS['err_msg']; ?></strong></td>

    <td align="right" width="25%" >

    <a href="manageProduct.php">

    <img src="images/left.png" border="0">

    </a>&nbsp;&nbsp;

    <a href="javascript:add_image();" title=" Add Socks Images">

    <img src="images/plus_icon.gif" border="0">

    </a>

    </td>

    </tr>

    <tr><td colspan="2">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <? if($count>0){ echo "<tr>";

    while($rsProductImage=mysql_fetch_array($exeProductImage)){

    if($col<=3)

    echo "<td valign='middle'>";

    else

    {

    echo "<tr><td valign='middle'>";$col=1;

    }

    if (file_exists("../productImages/".$rsProductImage['image_name'].""))

    {list($width, $height, $type, $attr)=getimagesize("../productImages/".$rsProductImage['image_name']."");

    ?>

    <div align="center"><a href="#" onClick="javascript:window.open('../largeImageShow.php?image_id=<?=$rsProductImage['image_id']?>','','width=<?=$width+50?>,height=<?=$height+80?>,top=150,resizable=yes,scrollbars=yes')"><img src="../productImages/thumbnail/thumb_<?=$rsProductImage['image_name']?>" border="0" title="Click on this image"></a><br> <a href="#" onClick="edit_default(<?=$rsProductImage['image_id']?>)" title="Select default"><? if($rsProductImage['default_image']==0) echo "<font color=\"#FF0000\">Default</font>"; else echo "<font color=\"green\">Default</font>";?></a>&nbsp;&nbsp;<a href="edit_prodect_images.php?image_id=<?=$rsProductImage['image_id']?>&product_id=<?=$_REQUEST['product_id']?>" title="Edit photo">Edit</a>&nbsp;&nbsp;<a href="#" onClick="javascript:delete_gallery(<?=$rsProductImage['image_id']?>);" title="Delete photo">Delete</a></div>

    <? }

    else

    {

    list($width, $height, $type, $attr)=getimagesize("../productImages/not_available.gif");

    ?>

    <div align="center"><a href="#" ><img src="../productImages/thumbnail/thumb_not_available.gif" border="0" title="Click on this image"></a><br> <a href="#" onClick="edit_default(<?=$rsProductImage['image_id']?>)" title="Select default"><? if($rsProductImage['default_image']==0) echo "<font color=\"#FF0000\">Default</font>"; else echo "<font color=\"green\">Default</font>";?></a>&nbsp;&nbsp;<a href="#" onClick="javascript:delete_gallery(<?=$rsProductImage['image_id']?>);" title="Delete photo">Delete</a></div>

    <? }

    ?>



    <? if($col<=3)

    {

    echo "</td>";$col++;

    }

    else

    echo "</td></tr>";

    }

    echo "</td></tr>";

    }

    else {

    ?>

    </table>

    </td></tr>

    <tr>

    <td align="center" colspan="2" class="smallred">No Image uploded</td>

    </tr>

    <? }?>

    </table>

    </form>

    <? }////////////// end of function add_color_image()?>

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Thumbs down I've gotten it to upload pictures now.

    But in the database (TABLE_PRODUCT_IMAGE_MASTER)the 'image_name' field (where the actual image file resides) is not injecting/populating.

  3. #3
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Red face

    I'm stuck now on this error.


    Fatal error: Call to undefined function add_color_image() in /admin_utils.php(65) : eval()'d code on line 1



    I removed the add_color_image but I still get the error.

    Need help please.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.33706 seconds
  • Memory Usage 2,879KB
  • Queries Executed 15 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates