Board index » Web Programming » Weird issue: SaveAs doesn't copy files properly
|
ded
|
Weird issue: SaveAs doesn't copy files properly
Web Programming298
I wrote some VB.NET code that loops thru a dir on the users local machine and uploads all the files to a server's subdir. It copies all of the files, but ALL THE FILES ARE 37KB in size. In reality they are 1kb, 4kb, 3kb, etc... The gifs don't even open up. Any ideas? Thanks. Here's the code... ' Upload the directory full of images Dim strImagesDir As String = "c:\temp\Myfiles" ' local users machine Dim d As System.IO.Directory ' Get a listing of the files Dim strFiles As String() = d.GetFiles(strImagesDir) For Each f As String In strFiles Dim strServerImagesDir As String = "c:\inetpub\wwwroot\MySite\My_Files" If Not d.Exists(strServerImagesDir) Then ' create images dir d.CreateDirectory(strServerImagesDir) End If ' upload each file MyFile.PostedFile.SaveAs(strServerImagesDir + "\" & System.IO.Path.GetFileName(f)) Next - |
