How to process/move uploaded files?

Last post 07-24-2008, 4:57 PM by Adam. 3 replies.
Sort Posts: Previous Next
  •  06-09-2008, 11:12 PM 41279

    How to process/move uploaded files?

    I have a wizard that lets users upload files and the users have to hit the Submit button at the end of the wizard.  The Submit button process the data in the wizard and the uploaded files.  I need to get a handle on the files that were uploaded.  Below is the code I have.  I cannot get the function below to work properly.  I guess the MoveTo function requires a GIUD so I use the function Guid.NewGuid  which does not return a GUID.  Guid.NewGuid.ToString returns a GUID but then the file location gives me an error saying "Named arguements expected." 
     
    How can I get a handle on the uploaded files that show up in the Grid/Listview and then move them elsewhere and process them?


    <
    asp:Table ID="Table11" runat="server">

    <asp:TableRow>

    <asp:TableCell VerticalAlign="Top" Width="100">File #1:

    </asp:TableCell>

    <asp:TableCell>

    <CuteWebUI:UploadAttachments runat="server" ID="Attachments1" InsertText="Attachments1">

    <ValidateOption MaxSizeKB="30720" />

    </CuteWebUI:UploadAttachments>

    </asp:TableCell>

    </asp:TableRow>

    <asp:TableRow>

    <asp:TableCell VerticalAlign="Top">File #3:

    </asp:TableCell>

    <asp:TableCell>

    <asp:Button ID="Button3" runat="server" Text="Button" />

    </asp:TableCell>

    </asp:TableRow>

    </asp:Table>

    Code Behind:
     

    Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click

    Attachments1.GetUploaderProvider.MoveTo(fileguid:=Guid.NewGuid.ToString,"c:\\temp\\")

    End Sub

  •  06-16-2008, 1:22 PM 41457 in reply to 41279

    Re: How to process/move uploaded files?

    Please use the following code:
     

        Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)
            Dim uploader As Uploader = DirectCast(sender, Uploader)
            InsertMsg("File uploaded! " & args.FileName & ", " + args.FileSize.ToString() & " bytes.")
       
            'Copys the uploaded file to a new location. 
            'args.CopyTo("c:\\temp\\"& args.FileName)
            'You can also open the uploaded file's data stream.
            'System.IO.Stream data = args.OpenStream()
        End Sub

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-24-2008, 4:52 PM 42525 in reply to 41457

    Re: How to process/move uploaded files?

    Thanks for posting this code.  What's the namespace?
     
    Aaron
  •  07-24-2008, 4:57 PM 42527 in reply to 42525

    Re: How to process/move uploaded files?

    CuteWebUI.AjaxUploader
     
    <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML