Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error msg: Failed to map the path '/' in file upload

Error msg: Failed to map the path '/' in file upload

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 3879881
    wrote on last edited by
    #1

    Hi guys i installed my vs2005 in c drive and i have my project in d drive in that project i am doing fileupload concept i given server mappath to save file: fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename) now my quest is the uploaded file will go and store in c drive or d drive inside the project..., Means, in which drive it will consider as server mappath? And see this is my code and its not at all storing the upload file in any of the drive... I am getting error message as Failed to map the path '/' See this is my code in button click event: Dim sqlquery As String = "-" Dim docid As Integer sqlquery = "select isnull(max(ResumeId),1000)+1 from tblonlineresume" sqlcmd = New SqlCommand(sqlquery, sqlconn) sqlcmd.Connection.Open() If sqlcmd.ExecuteScalar() > 0 Then docid = sqlcmd.ExecuteScalar End If sqlcmd.Connection.Close() sqlcmd.Dispose() Dim filename As String = docid & System.IO.Path.GetFileName(fileupload1.PostedFile.FileName) strdate = txtdob.Text If Mid(strdate, 2, 1) = "/" Then strdate = "0" & strdate If Mid(strdate, 5, 1) = "/" Then strdate = Left(strdate, 3) & "0" & Mid(strdate, 4, 6) txtdob.Text = Mid(strdate, 4, 3) & Mid(strdate, 1, 2) & Mid(strdate, 6, 5) Try sqlcmd = New SqlCommand("submitOnlineResume'" & ddlJob.SelectedValue & "','" & txtName.Text & _ "',' " & txtemail.Text & "','" & txtQualify.Text & "','" & ddlYpass.SelectedValue & "','" & _ Mid(txtdob.Text, 4, 3) & Mid(txtdob.Text, 1, 3) & Mid(txtdob.Text, 7, 4) & "','" & _ ddlfarea.SelectedValue & "','" & ddlAspec.SelectedValue & "','" & txtsset.Text & _ "','" & filename & "'", sqlconn) sqlcmd.Connection.Open() sqlcmd.ExecuteScalar() fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename) lblMessage.Text = "The file has been uploaded." sqlcmd.Connection.Close() sqlcmd.Dispose() Catch ex As Exception lblMessage.Text = ex.Message Finally End Try sqlcmd.Connection.Close() sqlcmd.Dispose()

    Thanks & Rega

    S 1 Reply Last reply
    0
    • M Member 3879881

      Hi guys i installed my vs2005 in c drive and i have my project in d drive in that project i am doing fileupload concept i given server mappath to save file: fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename) now my quest is the uploaded file will go and store in c drive or d drive inside the project..., Means, in which drive it will consider as server mappath? And see this is my code and its not at all storing the upload file in any of the drive... I am getting error message as Failed to map the path '/' See this is my code in button click event: Dim sqlquery As String = "-" Dim docid As Integer sqlquery = "select isnull(max(ResumeId),1000)+1 from tblonlineresume" sqlcmd = New SqlCommand(sqlquery, sqlconn) sqlcmd.Connection.Open() If sqlcmd.ExecuteScalar() > 0 Then docid = sqlcmd.ExecuteScalar End If sqlcmd.Connection.Close() sqlcmd.Dispose() Dim filename As String = docid & System.IO.Path.GetFileName(fileupload1.PostedFile.FileName) strdate = txtdob.Text If Mid(strdate, 2, 1) = "/" Then strdate = "0" & strdate If Mid(strdate, 5, 1) = "/" Then strdate = Left(strdate, 3) & "0" & Mid(strdate, 4, 6) txtdob.Text = Mid(strdate, 4, 3) & Mid(strdate, 1, 2) & Mid(strdate, 6, 5) Try sqlcmd = New SqlCommand("submitOnlineResume'" & ddlJob.SelectedValue & "','" & txtName.Text & _ "',' " & txtemail.Text & "','" & txtQualify.Text & "','" & ddlYpass.SelectedValue & "','" & _ Mid(txtdob.Text, 4, 3) & Mid(txtdob.Text, 1, 3) & Mid(txtdob.Text, 7, 4) & "','" & _ ddlfarea.SelectedValue & "','" & ddlAspec.SelectedValue & "','" & txtsset.Text & _ "','" & filename & "'", sqlconn) sqlcmd.Connection.Open() sqlcmd.ExecuteScalar() fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename) lblMessage.Text = "The file has been uploaded." sqlcmd.Connection.Close() sqlcmd.Dispose() Catch ex As Exception lblMessage.Text = ex.Message Finally End Try sqlcmd.Connection.Close() sqlcmd.Dispose()

      Thanks & Rega

      S Offline
      S Offline
      samMaster
      wrote on last edited by
      #2

      Hi, Test this code: fileupload1.PostedFile.SaveAs(Server.MapPath("~\") & "OnLineResumes\" & filename)

      M 1 Reply Last reply
      0
      • S samMaster

        Hi, Test this code: fileupload1.PostedFile.SaveAs(Server.MapPath("~\") & "OnLineResumes\" & filename)

        M Offline
        M Offline
        Member 3879881
        wrote on last edited by
        #3

        Hey man its great, So we have to mention ~ symbol, Ok but one of my senior did with out that symbol, but code is same what i have mention before, So how he can get it?, whats wrong in my code?

        Thanks & Regards, NeW OnE, please don't forget to vote on the post

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups