title: VB Saving img file with path adds folder name to file name
body: <p>Hi I am having some problems with saving img files using Visual Basic, the files are being named wrongly with the folder name being added to the start of the file name.</p>
  
  <p>I parse a web address and then use the split address values to rename my files however the the path value seems to be added to the file as well. </p>
  
  <p>The files in the photo should be named for example "DCAT040iMBE Test13.jpg" 
  but this file is being name "Test1DCAT040iMBE Test13.jpg" </p>
  
  <p><a href="https://i.stack.imgur.com/KJ228.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KJ228.png" alt="enter image description here"></a></p>
  
  <pre><code>Protected Sub GeneratedCode()
      Dim path As String = "C:\Users\Grey\Documents\visual studio 2010\Projects\QRCodeGenerator\QRCodeGenerator\Output\"
      LogoUpload.SaveAs(path + LogoUpload.FileName)
      TextFile.SaveAs(path + TextFile.FileName)
      Dim lines() As String = IO.File.ReadAllLines(path + TextFile.FileName)
      For Each line As String In lines
  
          Dim count As Integer
          Dim encoder As New QRCodeEncoder()
          encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H
          encoder.QRCodeScale = 10
  
          Dim img As Bitmap = encoder.Encode(line)
          Dim logo As System.Drawing.Image = System.Drawing.Image.FromFile(path + LogoUpload.FileName)
          Dim left As Integer = (img.Width / 2) - (logo.Width / 2)
          Dim top As Integer = (img.Height / 2) - (logo.Height / 2)
          Dim g As Graphics = Graphics.FromImage(img)
  
          Dim parseLine = line
          Dim replaceDelimiter As String
          If Not String.IsNullOrWhiteSpace(line) Then
              replaceDelimiter = Replace(line, "&amp;", "=")
          End If
  
          Dim fileNameSplit() As String = replaceDelimiter.Split("=")
          Dim newFileName As String
  
          Dim partTwo = fileNameSplit(1)
          Dim partSix = fileNameSplit(5)
  
          Dim objFSO
          Dim newFolder As String
          newFolder = "C:\Users\Grey\Documents\visual studio 2010\Projects\QRCodeGenerator\QRCodeGenerator\Output\" + partSix
          objFSO = CreateObject("Scripting.FileSystemObject")
          If (Not System.IO.Directory.Exists(newFolder)) Then
              System.IO.Directory.CreateDirectory(newFolder)
          End If
  
          count += 1
          g.DrawImage(logo, New Point(left, top))
          newFileName = partTwo &amp; " " &amp; partSix &amp; count &amp; ".jpg"
  
          img.Save(newFolder + newFileName, ImageFormat.Jpeg)
  
          amountCreatedLbl.Text = count &amp; " QRCodes Created"
          logo.Dispose()
      Next
  
  End Sub
  </code></pre>
  
  <p>Could it be that I am generating my newFolder Values wrongly?</p>
  
  <p>edited to add an example of data from the parsed txt file.</p>
  
  <blockquote>
  <pre><code>  https://mywebsite.com/QRCode/default.aspx?materialcode=DTAT050&amp;Logo=MyLogo&amp;Companyloc=Test1
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT055iMB&amp;Logo=MyLogo&amp;Companyloc=Test1
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT040iMBE&amp;Logo=MyLogo&amp;Companyloc=Test1
      https://mywebsite.com/QRCode/default.aspx?materialcode=DTAB060&amp;Logo=MyLogo&amp;Companyloc=Test1
  </code></pre>
  </blockquote>
  
  <pre><code>    https://mywebsite.com/QRCode/default.aspx?materialcode=DTAT050&amp;Logo=MyLogo&amp;Companyloc=Test2
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT055iMB&amp;Logo=MyLogo&amp;Companyloc=Test2
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT040iMBE&amp;Logo=MyLogo&amp;Companyloc=Test2
      https://mywebsite.com/QRCode/default.aspx?materialcode=DTAB060&amp;Logo=MyLogo&amp;Companyloc=Test2
  
      https://mywebsite.com/QRCode/default.aspx?materialcode=DTAT050&amp;Logo=MyLogo&amp;Companyloc=Test3
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT055iMB&amp;Logo=MyLogo&amp;Companyloc=Test3
      https://mywebsite.com/QRCode/default.aspx?materialcode=DCAT040iMBE&amp;Logo=MyLogo&amp;Companyloc=Test3
      https://mywebsite.com/QRCode/default.aspx?materialcode=DTAB060&amp;Logo=MyLogo&amp;Companyloc=Test
  </code></pre>