Upload from Standard Button

Jun 24, 2009 at 9:25 AM

1st. Awesome component. Thanks for releasing it under MIT. I have accomplished some simple uploads in testing but need it to do some dynamic uploads.

Here is what I want to accomplish.

a page with a textbox. User fill in textbox(txtnewgalleryname), select some images to upload via flajaxian. Click a standard button (btninsertimages), a folder is created, flajaxian uploads all the selected files to that directory.

So far the directory creation is working. I am not sure how to get flajaxian to upload the files from a standard button event. I am out of ideas. See vb code below, its been edited to hide private data.

Thanks for any suggestions.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Copy of CreateGallery.aspx.vb" Inherits="gallery2" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>

<!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">
    <style type="text/css">
            width: 34%;
            height: 87px;



    <form id="form1" runat="server">
        <br />
            Create Gallery
        <br />
        <table class="style1">
        <asp:TextBox ID="txtNewGalleryName" runat="server" Width="294px"></asp:TextBox>
                    Upload Images</td>
                    <fjx:FileUploader AllowedFileTypes="Web Images (Jpeg, Gig, Png):*.jpg;*.jpeg;*.png;*.gif" ID="FileUploader1" runat="server" >
     <fjx:FileSaverAdapter Runat="server" />
    <%--    <fjx:ThumbGeneratorAdapter Runat="server"
            Extensions="jpg;jpeg" FolderName="Images\Galleries"
             MaximumWidth="200" MaximumHeight="200" />--%>


                <br />
        <br />
    <asp:Button ID="btnInsertImage" runat="server" Text="Insert Data"    />
    <br />
    <br />
    <asp:Label ID="lblAlarm" runat="server" style="color: #FF0000"></asp:Label>
    <br />




<<code behind>>>

Imports System.IO
Imports com.flajaxian
Partial Class gallery2
    Inherits System.Web.UI.Page
       Dim strUploadFolder As String
    'refresh the page
Public Sub ReFresh()
        Dim currentPage As String
        currentPage = "default.aspx"

    End Sub

    Public Sub CreateFolder()
        Dim directory As Directory
        Dim newgalleryname As String
        newgalleryname = txtNewGalleryName.Text
        Dim myUploadpath As String = Server.MapPath(".")
        strUploadFolder = myUploadpath + "\Images\Galleries\" + newgalleryname
        If (Not directory.Exists(strUploadFolder)) Then
        End If

    End Sub

Protected Sub btnInsertImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsertImage.Click

        'create folder

 'set folder to upload to
 'refresh page

    End Sub

Public Sub setUploadFoder()

'set folder and upload?
       DirectCast(FileUploader1.Adapters(0), FileSaverAdapter).FolderName = strUploadFolder
End Sub