Get filename of posted file

Last post 06-21-2009, 10:51 PM by cutechat. 2 replies.
Sort Posts: Previous Next
  •  06-19-2009, 6:44 PM 53314

    Get filename of posted file

    I'm using a fileupload control in my page end this little code to store the filename in the db:
     
    1. If uploader1.PostedFile.ContentLength <> 0 Then  
    2.             Dim spatie As String = uploader1.FileName.ToString  
    3.             spatie = spatie.Replace(" """)  
    4.             uploader1.PostedFile.SaveAs(Server.MapPath("/img/auto/") & uploader1.FileName.ToString)  
    5.   
    6. End If 
     I tried replace the normal fileupload component with the ajaxuploader, but i found no method to get the filename of the uploaded file. This has to be stored in my products table and the file has to be uploaded to folder ~/img/auto/
     
    How do i get the filename??? i''m using vb.net in the codebehind
  •  06-20-2009, 1:20 PM 53322 in reply to 53314

    Re: Get filename of posted file

     

    1. Private Sub Uploader_FileUploaded(ByVal sender As ObjectByVal args As UploaderEventArgs)   
    2.         Dim uploader As Uploader = DirectCast(sender, Uploader)   
    3.         InsertMsg("File uploaded! " & args.FileName & ", " + args.FileSize.ToString() & " bytes.")   
    4.        
    5.         'Copys the uploaded file to a new location.    
    6.         'args.CopyTo("c:\\temp\\"& args.FileName  
    7.         'You can also open the uploaded file's data stream.    
    8.         'System.IO.Stream data = args.OpenStream();    
    9.     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

  •  06-21-2009, 10:51 PM 53334 in reply to 53314

    Re: Get filename of posted file

    Hi,
     
    Are you using the correct control ?
     
    AjaxUploader do not has the PostedFile property. That is the property of the ASP.NET FileUpload control.
     
    Regards,
    Terry
     
View as RSS news feed in XML