Weird issue: SaveAs doesn't copy files properly

V

VB Programmer

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
 
V

VB Programmer

When I upload the files INDIVIDUALLY they work fine. When I upload MULTIPLE
files this happens.

MyFile is defined as this in html...
<INPUT id="MyFile" type="file" size="40" name="MyFile" RunAt="Server"
DESIGNTIMEDRAGDROP="490">

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top