|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Uploading and renameing imagesame, it renames it and saves it, but when you look at the renamed image, it is an x. ' Read file into a data stream Dim myData(nFileLen) As Byte myFile.InputStream.Read(myData, 0, nFileLen) ' Make sure a duplicate file doesn't exist. If it does, keep on appending an incremental numeric until it is unique sFilename = System.IO.Path.GetFileName(myFile.FileName) Dim file_append As Integer = 0 While System.IO.File.Exists(Server.MapPath((sSavePath + sFilename))) file_append = (file_append + 1) sFilename = (System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) _ + (file_append.ToString + ".jpg")) sFilenameNoExt = (System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + file_append.ToString) End While ImageFileName.Text = sFilename ' Save the stream to disk Dim newFile As System.IO.FileStream = New System.IO.FileStream(Server.MapPath((sSavePath + sFilename)), System.IO.FileMode.Create) newFile.Write(myData, 0, myData.Length) newFile.Close() Does the file size = 0k?
Calvin Luttrell How e-commerce is done. http://blog.projectthunder.com http://www.projectthunder.com <dfetrow***@hotmail.com> wrote in message Show quoteHide quote news:1157738194.727683.245840@m79g2000cwm.googlegroups.com... > It will upload the first image, but if their is an image named the > same, it renames it and saves it, but when you look at the renamed > image, it is an x. > > > ' Read file into a data stream > Dim myData(nFileLen) As Byte > myFile.InputStream.Read(myData, 0, nFileLen) > ' Make sure a duplicate file doesn't exist. If it does, > keep on appending an incremental numeric until it is unique > sFilename = System.IO.Path.GetFileName(myFile.FileName) > Dim file_append As Integer = 0 > > While System.IO.File.Exists(Server.MapPath((sSavePath + > sFilename))) > file_append = (file_append + 1) > sFilename = > (System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) _ > + (file_append.ToString + ".jpg")) > sFilenameNoExt = > (System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + > file_append.ToString) > > End While > ImageFileName.Text = sFilename > ' Save the stream to disk > Dim newFile As System.IO.FileStream = New > System.IO.FileStream(Server.MapPath((sSavePath + sFilename)), > System.IO.FileMode.Create) > newFile.Write(myData, 0, myData.Length) > newFile.Close() >
Hiding a Property
LAN IP Writing a brute force program using SendKeys.Send self-extracting files in .net Extending an Abstract class that uses a Generic Parameter AxSHDocVw.AxWebBrowser events File Not Accessed Restricting the resizing of forms Adding row to data table in .net 2.0 String quickie: Remove trailing space from each RichTextBox line? |
|||||||||||||||||||||||