Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi all experts,
I try to upload my file to server. but all files uploaded become 0 byte and can't open.
the above is my source code to upload by using FileUpload Control.
String FileName="D:\DOCUMENTS\MYCV.doc";
cmdupload.PostedFile.SaveAs(Server.MapPath("~/Files/") + FileName);
After uploaded, i checked my file again and the size of this is 0 byte and i can't open this file too.
 
Does anybody know about this?
 
Thanks
 
TONY
Posted 20-Feb-13 21:06pm
Comments
OriginalGriff at 21-Feb-13 3:14am
   
Show the whole method you are using to save the file - the click event handler.
Richard MacCutchan at 21-Feb-13 5:43am
   
You have include the drive letter and root directory in your filename; that will lead to an invalid path on the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 531
1 OriginalGriff 334
2 DamithSL 235
3 Maciej Los 170
4 Bruno Sprecher 130
0 DamithSL 95
1 OriginalGriff 65
2 Gopu Raj 30
3 Mahsa Hassankashi 25
4 Raul Iloc 25


Advertise | Privacy | Mobile
Web04 | 2.8.141030.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100