Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 27, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Browse for File
Bill
Posts: 10
 
Browse for FileYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Jul 12 1:47 PM
fiogf49gjkf0d

I am looking to essentially recreate the Attachment tab.  The customer has their own brand of attachments that used a lookup set to mode lmfile to browse to select a file.  That doesn't exist in the web.  I've tried to use the standard browsing from C# but the namespace doesn't exist in the web.  Anyone have any thoughts?

[Reply][Quote]
Remy
Posts: 42
 
Re: Browse for FileYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Jul 12 2:45 PM
fiogf49gjkf0d

try creating a custom page similar to this (i started working on it a while ago and never really implemented it):


 


<p> 

<%@ Page Language="C#" AutoEventWireup="true" %>


<!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>

</head>

<body>

    <form id="form1" runat="server">

    <asp:Panel ID="pnlUpload" runat="server">

        <div style="height: 80px;">

            <asp:Label ID="lblWelcomeMessage" runat="server" Text="Add an Attachment"

                Font-Size="11px" Font-Names="'Lucida Grande',Verdana,Arial,Sans-Serif" ForeColor="#555555"></asp:Label>

                <br /><br />

            <asp:FileUpload ID="FileUpload1" runat="server" />

        </div>

        <div style="height: 30px;">

            <asp:Button Text="Add" ID="btnUpload" runat="server" OnClick="btnUpload_Click" />

        </div>

    </asp:Panel>

    <asp:Panel ID="pnlAfterUpload" runat="server" Visible="false">

        <asp:Label ID="lblMessage" Text="Your File Has Been Successfully Saved" ForeColor="Red"

            runat="server"></asp:Label>

    </asp:Panel>

    </form>

</body>

</html>

 

<script runat="server" type="text/C#">

protected override void OnLoad( EventArgs e )

{

}

protected void btnUpload_Click(object sender, EventArgs e)

        {

        string quoteid = Request.QueryString["q"];

            try

            {

                //Get the root folder from web config.

                string savePath = @"\\SERVER\ATTACHMENTS\" + quoteid + @"\";

                string tempfileName = "";

                if (!System.IO.Directory.Exists(savePath)) 

                {

                  System.IO.DirectoryInfo di = System.IO.Directory.CreateDirectory(savePath);

                }


                 if (FileUpload1.HasFile)

                {

                      // Get the name of the file to upload.

                      String fileName = FileUpload1.FileName;

                      // Create the path and file name to check for duplicates.

                      string pathToCheck = savePath + fileName;


                       // Append the name of the file to upload to the path.

                      savePath += fileName;

                       // Check to see if a file already exists with the

                        // same name as the file to upload.        

                        if (System.IO.File.Exists(pathToCheck)) 

                        {

                          int counter = 2;

                          while (System.IO.File.Exists(pathToCheck))

                          {

                            // if a file with this name already exists,

                            // prefix the filename with a number.

                            tempfileName = counter.ToString() + fileName;

                            pathToCheck = savePath + tempfileName;

                            counter ++;

                          }

                          fileName = tempfileName;


                           // Notify the user that the file name was changed.

                          lblMessage.Text = "A file with the same name already exists." + "<br />Your file was saved as " + fileName;

                        }

                        else

                        {

                          // Notify the user that the file was saved successfully.

                          lblMessage.Text = "Your file was uploaded successfully.";

                        }

 

                      // Call the SaveAs method to save the 

                      // uploaded file to the specified path.

                      FileUpload1.SaveAs(savePath);

                //Hide the upload panel

                pnlUpload.Visible = false;

                //View message to notify the user that the his file has been uploaded.

                pnlAfterUpload.Visible = true;

                string sql;

                string oppquoteid = Request.QueryString["q"];

 


                string connStr = "Provider=SQLOLEDB;integrated security=SSPI;data source=localhost;" + "persist security info=False;initial catalog=saleslogix;";

                using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connStr))

                {

                    //Open connection

                    conn.Open();

                    using (System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand())

                    {

                        //Build and execute SQL

                        sql = "INSERT INTO dbo.OPPQUOTEATTACH_TEMP (OPPQUOTEID, FILENAME) VALUES ('" + oppquoteid + "', '" + fileName + "')";

                        cmd.Connection = conn;

                        cmd.CommandText = sql;

                         cmd.ExecuteNonQuery();

                    }

                }

               }

            }

            catch (Exception x)

            {

                throw x;

            }

     }

</script>


 



 


[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/27/2025 8:57:52 PM