upload path

Thread is closed for posting
6 posts, 1 answers
  1. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 14 Jan 2010 Link to this post

    hi

    how do i capture the document path into DB? for example, if after upload the path to the document is C:\somefolder\somefolder\somefile.pdf, the DB should have a row value C:\somefolder\somefolder\somefile.pdf.

    Thanks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Jan 2010 Link to this post

    Hello,

    You can use the following code snippet in order to retrieve the filepath of uploaded file.

             RadUpload1.UploadedFiles[0].FileName;

    [The 'FileName' property returns the fully qualified name of the file on the client. (IE6 and some older browsers only). To get a file name that is the same for all browsers, use the GetName() method instead.]




    -Shinu.
  3. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 15 Jan 2010 Link to this post

    hi

    I have this code:

     

    Dim filename As String = System.Guid.NewGuid().ToString.Replace("-", "0")

    How do I dynamically create a folder and rename upload file using the filename variables which is a GUID?

    By the way, what is the difference between Target Forlder and Physical Target Folder? Thanks

     

  4. suresh kharod
    suresh kharod avatar
    1 posts
    Member since:
    Oct 2009

    Posted 15 Jan 2010 Link to this post

    hello All

     i am a fresher for telerik Contorls

    I am facing a problem in using telerik control. 

    I have developed a small windows application. and put one RAD Grid view in a form. 

    when i am opening the form it is taking 5 -6 times more time as compare to other form without telerik grid. how to solve this problem

    thanks in advance for your help

    Suresh Kharod

  5. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 17 Jan 2010 Link to this post

    hi

    I am able to create a folder dynamically but is not able to rename the file according to the new folder name.

    here is my code:

        Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
            Dim filename As String = System.Guid.NewGuid().ToString.Replace("-", "0")
            Dim filepath As String = "~/upload/" & filename
            Directory.CreateDirectory(Server.MapPath(filepath))

            For Each f As UploadedFile In RadUpload1.UploadedFiles
                Dim targetFileName As String = System.IO.Path.Combine(filepath, filename & f.GetExtension)
                f.SaveAs(targetFileName)
            Next

        End Sub

  6. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 18 Jan 2010 Link to this post

    Hello L,

    You need to change the following line:

    Dim targetFileName As String = System.IO.Path.Combine(filepath, filename & f.GetExtension)

    to

    Dim targetFileName As String = System.IO.Path.Combine(Server.MapPath(filepath), filename & f.GetExtension)

    Expect from that, everything else works correctly. I have prepared sample project that demonstrates the approach, you can find it as an attachment.

    suresh kharod,

    This forums is for ASP.NET controls, not for WindowsForms ones. I suggest that you navigate to this link and open a thread describing your problem there.

    Sincerely yours,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top