[thelist] Upload file with hyphen in name

Jay Blanchard jay.blanchard at THERMON.com
Mon Feb 13 08:21:13 CST 2006


[snip]
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\th
umbs\" 
+ 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?
[/snip]

a. Naming conventions should never be system critical items
2. Escape all special characters



More information about the thelist mailing list