473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Weird issue: SaveAs doesn't copy files properly

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
Nov 19 '05 #1
1 967
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?

"VB Programmer" <xD**********@Dont.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TOM | last post by:
I want to saveas silently ! it will not prompt to user for saveas please tell me how can I do this silently. please do replay ! OLEObject IE IE = CREATE OLEObject
8
by: Arun Bhalla | last post by:
Hi, I'm developing an Explorer bar using VS.NET 2003 (C#) on Windows XP. For some time, I've noticed that I don't have filenames and line numbers appearing in my exceptions' stack traces. On...
0
by: Tyrven | last post by:
I have a localized website that has been in production for sometime. Recently, localizations for one particularly locale (zh-TW) stopped displaying on the test application; the same locale works...
5
by: genc_ymeri | last post by:
Hi over there, We are a team of 6 developping web applications (ASP.Net/C#/VB.Net/SQLServer). What happens is that randomly, each of us get the below error in (PS). We believe that the "acess is...
18
by: atv | last post by:
at least to me it is. I can't figure out for the life what it is i'm doing wrong here. i have a function called assign_coordinate. usually, i pass a malloced pointer to it, then individual...
1
by: Edmund | last post by:
I hope someone can help me out set up the security properly. I have Microsoft Access 97 and Access 2000 in my computer and I developed my database with Access 2000 with the updated patch...
20
by: ongaro.admin | last post by:
Hi, I'm experiencing a strange problem with .mdb files. We have two buildings connected by optical fiber (a single LAN). Everything works perfect with any file, any size, any application...
4
by: jld730 | last post by:
Greetings! A user will supply a .xls or .csv file (with location/directory) as a system argument. If it is a CSV file, the script moves on. If it is a XLS/XLSX file, the script should save it as...
1
by: Repairman2003 | last post by:
I'm using <a href="javascript:document.execCommand('SaveAs', true, 'folder/file.ext')but it always returns false no matter what because of the fact that I'm trying to save a file that isn't in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.