FileUploadField help

  1. #1

    FileUploadField help


    I have the following code which uses a FileUploadField field, how do I access the file to upload it to my server? Can I do this in my code behind file? If the control saves the file without my needing to use a code behind file how do I know where the file will be saved and can I set it's path?

    <%@ Control Language="VB" AutoEventWireup="true" CodeFile="pulsebar.ascx.vb" Inherits="pages_cms_controls_pulseBar" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
     <asp:SqlDataSource ID="pulseDataSource" 
        ConnectionString="<%$ ConnectionStrings:HomePage %>" 
        SelectCommand="SELECT * FROM Pulse WHERE deleted=0 ORDER BY publishon DESC" 
        InsertCommand="INSERT INTO Pulse (URL, Image, Title, publishon, modified, deleted, published) VALUES (@URL, @Image, @Title, @publishon, GetDate(), 0, 0)"
        DeleteCommand="UPDATE Pulse SET deleted=1, modified=GetDate() WHERE PulseID=@PulseID"
        UpdateCommand="UPDATE Pulse SET publishon=@publishon, published=@published, modified=GetDate(), URL=@URL, Image=@Image, Title=@Title WHERE PulseID=@PulseID"
            <asp:Parameter Name="URL" />
            <asp:Parameter Name="Image" />
            <asp:Parameter Name="Title" />
             <asp:Parameter Name="PulseID" />
            <asp:Parameter Name="PulseID" />
            <asp:Parameter Name="Title" />
            <asp:Parameter Name="URL" />
            <asp:Parameter Name="Image" />
            <asp:Parameter Name="published" Type="Boolean" />	                        	                        
    <ext:Store ID="pulseStore" runat="server" DataSourceID="pulseDataSource">
            <ext:JsonReader ReaderID="PulseID">
                    <ext:RecordField Name="URL" />
                    <ext:RecordField Name="Title" />
                    <ext:RecordField Name="Image" />
                    <ext:RecordField Name="published" Type="Boolean" />
                    <ext:RecordField Name="publishon" Type="Date" />
          <asp:Literal runat="server" ID="debug" />
    <ext:GridPanel ID="pulseGridPanel"  runat="server" StoreID="pulseStore" Width="985" Height="470" BodyBorder="false" >
            <ext:Toolbar ID="Toolbar2" runat="server">
                    <ext:Button ID="Button4" runat="server" Text="Add" Icon="Add">
                            <Click Handler="#{pulseGridPanel}.insertRecord();" />
                    <ext:Button ID="Button5" runat="server" Text="Save" Icon="DatabaseSave">
                            <Click Handler="#{pulseGridPanel}.save();" />
                    <ext:Button ID="Button1" runat="server" Text="Reload" Icon="Reload">
                            <Click Handler="#{pulseGridPanel}.reload();" />
                <ext:CommandColumn Width="30">
                        <ext:GridCommand Icon="Delete" CommandName="Remove">
                            <ToolTip Text="Remove" />
                <ext:Column Header="Title" DataIndex="Title" Width="250">
                        <ext:TextField ID="TextField1" runat="server"></ext:TextField>
                <ext:Column Header="Image" DataIndex="Image" Width="150">
                       <ext:FileUploadField ID="ImageUpload" DataIndex="Image" ButtonText="Browse" runat="server" ButtonOnly="true" />
                <ext:Column Header="URL" DataIndex="URL" Width="350">
                        <ext:TextField ID="TextField5" runat="server"></ext:TextField>
                <ext:CheckColumn ColumnID="published" Header="Published" Align="Center" DataIndex="published" Width="90" Editable="true" />
                <ext:Column Header="Publish On" DataIndex="publishon">
                    <Renderer Fn="Ext.util.Format.dateRenderer('d-M-Y')" />
                        <ext:DateField ID="DateField1" runat="server" Format="dd-MMM-Y"></ext:DateField>
            <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" SingleSelect="true">
            <Command Handler="#{pulseGridPanel}_handleDelete();" />
        <LoadMask ShowMask="true" />                           
    <script type="text/javascript">
        function <%= pulseGridPanel.ClientID %>_handleDelete () {
               msg: 'Are you sure you want to delete?',
               buttons: Ext.Msg.YESNO,
               fn: <%= pulseGridPanel.ClientID %>_processDelete,
               icon: Ext.MessageBox.QUESTION
        function <%= pulseGridPanel.ClientID %>_processDelete (response) {
            if (response == 'yes') {
                <%= pulseGridPanel.ClientID %>.deleteSelected();
                <%= pulseGridPanel.ClientID %>.save();
    Last edited by geoffrey.mcgill; Jul 26, 2010 at 5:30 PM. Reason: please use [code] tags

Similar Threads

  1. FileUploadField can't upload ????
    By metallica87 in forum 1.x Help
    Replies: 1
    Last Post: Mar 11, 2010, 8:39 AM
  2. [CLOSED] FileUploadField
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 08, 2010, 12:31 PM
  3. FileUploadField can't work
    By Fresh.Killer in forum 1.x Help
    Replies: 1
    Last Post: Dec 07, 2009, 9:26 AM
  4. FileUploadField
    By matthaus in forum 1.x Help
    Replies: 0
    Last Post: Jun 01, 2009, 7:05 AM
  5. FileUploadField Script Bug
    By Birgit in forum 1.x Help
    Replies: 5
    Last Post: Apr 22, 2009, 1:40 PM

Posting Permissions