[thelist] Upload file with hyphen in name

Casey aspnet at thecrookstons.com
Mon Feb 13 08:18:17 CST 2006


In asp.net, I'm allowing the user to upload files to their server. 
Standard.  However, when the file has a hyphen in the name it fails to 
upload.  Having hyphens in the names of the images is system critical and 
there is no way we can work around it.

sub btnUpload(Sender as Object, e as EventArgs)
 Dim picPath as String = uploadThumb.PostedFile.FileName
 Dim picTitle as string = System.IO.Path.GetFileName(picPath)
 Try
  uploadThumb.PostedFile.SaveAs("E:\web\users\jewelfire.com\images_products\thumbs\" 
+ picTitle)
  Span1.InnerHtml = "Upload Sucessfully.<br>File Name: " &  picTitle
  Span1.visible=true
 catch Exp as exception
  span1.InnerHtml = "An Error occured."
 End Try
end sub

Is there a trick to getting this to work with hyphens?

Casey Crookston
InternetOpus
www.internetopus.com
320-267-0166





More information about the thelist mailing list