smurpetx's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
9 (0.02 per day)
Joined:
23-January 13
Profile Views:
506
Last Active:
User is offline Feb 10 2013 07:34 PM
Currently:
Offline

Previous Fields

Country:
PH
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0
Icon   smurpetx Welcome ! :D

Posts I've Made

  1. In Topic: Java Applet in IE9 "NOT" Working.

    Posted 29 Jan 2013

    @Farrel, i've that one already, but still error occurs.

    @Ghlavac , and ? any solution ?
  2. In Topic: Object Required Error.

    Posted 29 Jan 2013

    View Posth4nnib4l, on 28 January 2013 - 08:16 AM, said:

    <asp:HiddenField 
        runat="server" 
        ID="hdnImageFileName1" 
        ClientIDMode="static" />
    
    


    Thanks for the response h4nnib4l, But when i try adding ClientIDMode="static" still not getting image upload in the web server. Always got an error says, Object Required.
      function uplImages()
                {                                               
                        flagUploadingStarted = true;
                         
                        // Uploading Image 1 if its present.
                        if(document.getElementById("<%=hdnImageFileName1.ClientID%>").value != "") // Error occurs here, "Object Required"
                        {           
                            uploadImage1(document.getElementById("<%=hdnImageFileName1.ClientId%>").value);
                        }
                }
    
    
    
  3. In Topic: Object Required Error.

    Posted 27 Jan 2013

    Thanks for the response. Here's the full code.

    @h4nnib4l - Never tried that one, im new at this. Still learning a lot of things. But thanks for the info, i might try that one sooner. :sweatdrop:/>


    @rgfirefly24 Here's the code, i've been using.

    // Default.aspx
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
        <style>
            .ImageDIV
            {
    	        height:400px; 
    	        width:500px; 
    	        overflow:auto;
    	        border:1px solid;
    	        cursor:pointer;
            }
            .LinkImage
            {
                cursor:pointer;
            }
        </style>
    </head>
    <body onkeypress="javascript:fnKeyPress();">
        <form id="form1" runat="server">
    
            <script type="text/javascript">
      
            var hoverColor = "#00000b"; //DIV Color when mouse is hover the DIV
            var defaultColor = "black"; //DIV default color
            var selectColor = "#000000"; // DIV color when its selected.
            var selectedDIV = "";        //ID of the DIV user has currently selected(it will be 1,2,3 or 4)                
            var objActiveX; //Object of Clipboard ActiveX control.
            
            //Success flags ,whenever it turns to true,it indicates corresponding image is uploaded to the server.
            //And when all 4 flags are TRUE we will actually post the form to the server.
            var success1 = false; 
            
            
            // Flag to indicate uploading is being started,so if in middle user tries to paste image or remove it,we can stop doing that.
            var flagUploadingStarted = false;
            // Variable to get the Current URL and attach httpUtil Page to be passed in ActiveX for sending httpRequest.
            var strURL;
            // Variable holding the Post strings for URL like Random number and type.-
            var postVar;        
            </script>
    
            <script language="javascript">
            window.onload = function() {            
                
               //Detect ActiveX component using try . . . catch block.
                try {                                        
                    objActiveX = document.getElementById("ClipboardActiveX");                    
                    
                } catch(ex) {
                    alert("Cannot initialize the ActiveX control. Please contact your administrator regarding this error.");                    
                }
                
                // Initializing URL and Post Variables.
                strURL = window.location.toString();
                strURL = strURL.substring(0, strURL.lastIndexOf("/"));
                strURL = strURL + "/HttpUtil1.aspx";
                postVar = "id=1&type=p";
            }
            </script>
    
            <div>
                <object id="ClipboardActiveX" classid="CLSID:D472AFDE-DA5E-43BA-9A5F-4F21882AAE4A"
                    codebase="ClipboardActiveX.dll">
                </object>
                <br />
                &nbsp;</div>
    
            <script type="text/javascript">
            //Function to highlight the DIV.
                function Highlight(id) 
                {                
                    document.getElementById("div" + id).style.border = "solid 2px " + hoverColor;
                }
            //Function to remove the highlight from DIV.
                function removeHighlight(id)
                {                         
                    if(selectedDIV != id)       
                        document.getElementById("div" + id).style.border = "solid 1px " + defaultColor;
                }
            //Function to Change the border for the grid which is selected,and re-set for others.
                function selectDiv(divID)
                {
                    selectedDIV = divID;                
                    document.getElementById("div1").style.border="solid 1px" + defaultColor;                
                    document.getElementById("div" + divID).style.border = "solid 3px" + selectColor;
                }
            //Function to handle Paste Image click event for all Images.
            function pasteonclick(id)
                {        
                    if(flagUploadingStarted == true)
                        return;
                        
                    selectDiv(id);
                    fnCall();
                }
            //Function be called when user presses CTRL + V.
            function fnKeyPress(sender, args) {            
                if(window.event.keyCode == 22)
                    fnCall();                                                
                else if(window.event.keyCode == 24 && selectedDIV != "")
                {                                                                
                    deleteonclick(selectedDIV);
                }
            }
            
        function pasteonclick(id)
        {        
            if(flagUploadingStarted == true)
                return;
                
            selectDiv(id);
            fnCall();
        }
    
        function deleteonclick(id)
        {
            if(flagUploadingStarted == true)
                return;
            switch(id)
            {
                case '1':
                        document.getElementById("img1").src = "";
                        document.getElementById("img1").style.display = "none";
                        document.getElementById("img1").value = "";
                        success1 = false;
                        break;            
            }
            selectDiv(id);
        }
            </script>
    
            <script type="text/javascript">
                                                       
                // Main Function to be called when user presses CTRL + V to paste the image into selected DIV.
                         function fnCall()
                {                                                                                                                                                                                                                                      
                    try
                    {                                                            
                        // Getting the Physical path on which,the images will be stored on client machine.
                        var PhysicalPathForTempImage = "c:\\Amit\\";
                        
                        // Getting ActiveX
                        //var objActiveX = document.getElementById("ClipboardActiveX");    
                        
                        //Newly created images will be saved at below path which is passed.
                        
                        var strFilePath = objActiveX.getCopiedImage(PhysicalPathForTempImage); 
    
                        // If Image file is not copied.
                        if (strFilePath.indexOf("ERR1") > -1)
                        {
                            alert("The file you have attempted to paste is not in a form that gTicket can store. It should be file with the extension '.jpg','.bmp', or '.gif'. Please contact your system administrator for help in uploading this file, as it may need to be converted to an appropriate format");
                            //document.getElementById("imgProgress").style.display = "none";
                            return false;
                        }
                        // If user has copied the contents which are not in Image format like text etc.
                        else if (strFilePath.indexOf("ERR2") > -1)
                        {
                            alert("The contents you have attempted to paste is not in a form that gTicket can store. It should be in format which can be saved in file with the extension '.jpg','.bmp', or '.gif'. Please contact your system administrator for help in uploading this file, as it may need to be converted to an appropriate format");
                            //document.getElementById("imgProgress").style.display = "none";
                            return false;   
                        }
                        else if (strFilePath.indexOf("ERR3") > -1)
                        {
                            alert("Failure occured in generating Image file from clipboard.Please try again after some time or if error continues contact your administrator quoiting this error.")
                            //document.getElementById("imgProgress").style.display = "none";
                            return false;
                        }
                        else if (strFilePath.indexOf("ERR4") > -1)
                        {
                            alert("System failed for creating target directory path provided in configuration file.Either create directory yourself or contact administrator to help you in creating / changing the directory path")
                            //document.getElementById("imgProgress").style.display = "none";
                            return false;
                        }
                        else
                        {
                            // The case if user has not selected any DIV and tried to paste the image.
                            if(selectedDIV == "")
                            {
                                alert("Please first select any DIV to paste an Image");
                                //document.getElementById("imgProgress").style.display = "none";
                            }
                            else
                            {
                                
                                //Image is displayed with selected source.
                                document.getElementById("img" + selectedDIV).style.display = "block";
                                document.getElementById("img" + selectedDIV).src = strFilePath;
                                
                                //Getting Image File Name.                        
                                //var strFileName = "";
                                //strFileName = strFilePath.substring(strFilePath.lastIndexOf("\\") + 1,strFilePath.length);
                                
                                //Storing the image File name in corresponding hidden Image variable.
                                switch(selectedDIV)
                                {
                                    case "1":
                                                document.getElementById("hdnImageFileName1").value = strFilePath;
                                                break;
                                }                                                                    
                            }
                        }   
                    }
                    catch(ex)
                    {
                        
                        var strError = ex.message;
                        // This Error may occur if user has not created the Temp Image Directory mentioned in Configuration File.
                        if(strError.indexOf("GDI+") > -1)
                        {
                            alert("The physical path you have provided in Configuration file,is not found to store temporary image files.Contact your administrator quoting this error.");                                                                
                            return false;
                        }                
                    }         
                }                                                    
            </script>
    
            <script type="text/javascript">
            //---------------------------------------------------IMAGE 1 UPLOAD--------------------------------------------------------------
                function uploadImage1(strFileName)
                {                        
                    var response;
                    try{        
                        response = objActiveX.UploadFiles(strFileName,strURL,postVar);
                        if(response == "")
                        {
                            success1 = true;
                            spImage1Saved.style.visibility = "visible";
                            alert("Image uploaded successfully...");
                                                    return true;
                        }
                        else
                        {
                            alert("Image 1 Uploading failed....See the response received....");
                            alert(response);
                            return false;
                        }    
                       }
                    catch(ex)
                    {
                        alert("Image 1 Uploading failed....See the response received....");
                        alert(response);
                    }
                }
                /*
                    Added : Functions to upload all available images to the server.
                    By : Amit Champaneri
                    On : 3th April 2008
                */
                function uplImages()
                {                                                
                        flagUploadingStarted = true;
                        
                        // Uploading Image 1 if its present.
                        if(document.getElementById("hdnImageFileName1").value != "")
                        {            
                            uploadImage1(document.getElementById("hdnImageFileName1").value);
                        }
                }
            </script>
    
            <table border="0" cellpadding="2" cellspacing="3" style="width: 50%; height: 50%;
                background-color: papayawhip;">
                <tr>
                    <td style="height: 22px" align="center">
                        <img id="imgPaste1" src="Images/imgPaste.gif" class="LinkImage" title="Click here to Paste any copied Image"
                            onclick="javascript:pasteonclick('1');" />&nbsp;
                        <img id="imgDel1" src="Images/imgDelete.gif" class="LinkImage" title="Click here to Remove this Image"
                            onclick="javascript:deleteonclick('1');" />
                        <span id="spImage1Saved" class="DefaultLabelBold" style="visibility: hidden;">Image Uploaded...</span>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <div id="div1" class="ImageDIV" onclick="selectDiv('1');" onmouseover="Highlight('1');"
                            onmouseout="removeHighlight('1');" title="Select this DIV & Press CTRL+V to paste any copied Image.">
                            <img id="img1" style="display: none;" />
                            <asp:HiddenField runat="server" ID="hdnImageFileName1" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <a href="javascript:uplImages();" style="font-family: Courior New">Upload This Image
                            To Server</a>
                    </td>
                </tr>
                <tr>
                    <td style="width: 100px">
                    </td>
                </tr>
            </table>        
        </form>
    </body>
    </html>
    
    
    
    
    


    View Postrgfirefly24, on 25 January 2013 - 11:28 AM, said:

     uploadImage1(document.getElementById("<%=hdnImageFileName1.ClientID%>").value)
    
    



    Also for us to really help you you're going to need to post the full code so we can look it over.


    I already tried this one, but still no luck :nervous: And, for the refference I posted the code that im currently working on.
  4. In Topic: Object Required Error.

    Posted 24 Jan 2013

    View Posth4nnib4l, on 24 January 2013 - 10:43 AM, said:

    Why are you using ASP in your Javascript getElementById call? The Javascript can do that on its own.

    function uplImages() {
        flagUploadingStarted = true;
    
        // Uploading Image 1 if its present.
        if (document.getElementById("myControl1").value != "") {
            uploadImage1(document.getElementById("myControl1").value)
        }
    }
    
    


    Just put the ID of whatever control you're looking for into the parenthesis (I assume the control's ID is "hdnImageFileName1", so that's what you'd put in there).


    I already tried using the control of the div
       uploadImage1(document.getElementById("myControl1").value)
       
    

    And by using that code, i'll be able to Paste the image in the clipboard which the user copy (or using any Image Editing Tool, like Window Snipping Tool) onto the webform (onto the selected div) But , it won't allow me to Upload the image into the web server, and the results is always displaying this

     <%@ Page Language="VB" AutoEventWireup="false" CodeFile="HttpUtil1.aspx.vb" Inherits="HttpUtil1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="frmHttpUtil" runat="server">
            <div>
            </div>
        </form>
    </body>
    </html>
    
    
     
    


    This is the content of HttpUtil1.aspx, and onto that page should i be directed when i click "Upload Image To the Server". And, Nothing uploaded in to the server.


    Thanks for the reply h4nnib4l. Hope you could help me in my problem :clap:
  5. In Topic: Object Required Error.

    Posted 23 Jan 2013

    The control ClipboardActiveX was made on VB.NET , im using it for my module in the webpage to allow me to paste the image to the webform. Anyways, Thanks for the info, :oops: didn't know yet the difference from PHP to ASP.NET.

    View Postsmurpetx, on 23 January 2013 - 09:47 PM, said:

    The control ClipboardActiveX was made on VB6 , im using it for my module in the webpage to allow me to paste the image to the webform. Anyways, Thanks for the info, :oops:/> didn't know yet the difference from PHP to ASP.NET.

My Information

Member Title:
New D.I.C Head
Age:
21 years old
Birthday:
December 9, 1992
Gender:
Location:
Philippines
Interests:
Networking, Social Media, Programming, Software/Hardware.
Full Name:
Arvin Verdad Ilustre
Years Programming:
2
Programming Languages:
VB6, Visual Studio .NET2010(VB.NET), PHP

Contact Information

E-mail:
Private
Facebook:
https://www.facebook.com/dhen.bordeaux

Friends

smurpetx hasn't added any friends yet.

Comments

Page 1 of 1
  1. Photo

    smurpetx Icon

    23 Jan 2013 - 22:02
    Good to be here in Dream-In-Code.
Page 1 of 1