• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

renaming a file during saving for the file loader

I want to rename my file during saving for the file loader. below is the code i am using

If d_FileToUpload.HasFile Then
                Try
                    If d_FileToUpload.PostedFile.ContentLength > 4000000 Then
                        Exit Sub
                    End If
                    d_FileToUpload.SaveAs(Server.MapPath("docs\" & d_FileToUpload.FileName))
               Catch ex As Exception
                End Try
            Else
             End If
0
Anthony Matovu
Asked:
Anthony Matovu
  • 2
1 Solution
 
CodeCruiserCommented:
Change this line

d_FileToUpload.SaveAs(Server.MapPath("docs\" & d_FileToUpload.FileName))

to

d_FileToUpload.SaveAs(Server.MapPath("docs\MyOwnName"))
0
 
CodeCruiserCommented:
Did you get the point? If you want to add extension of the original file then

d_FileToUpload.SaveAs(Server.MapPath("docs\MyName" & IO.Path.GetExtension(d_FileToUpload.FileName)))
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now