This is a migrated thread and some comments may be shown as answers.

upload path

5 Answers 123 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 15 Jan 2010, 01:49 AM
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

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jan 2010, 06:13 AM
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.
0
L
Top achievements
Rank 1
answered on 15 Jan 2010, 07:29 AM
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

 

0
suresh kharod
Top achievements
Rank 1
answered on 15 Jan 2010, 07:37 AM

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

0
L
Top achievements
Rank 1
answered on 17 Jan 2010, 08:13 AM
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

0
Accepted
Genady Sergeev
Telerik team
answered on 18 Jan 2010, 10:39 AM
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.
Tags
Upload (Obsolete)
Asked by
L
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
L
Top achievements
Rank 1
suresh kharod
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or