Last post Dec 04, 2007 07:44 AM by Suprotim Agarwal
Nov 29, 2007 10:24 AM|hemangiGujar|LINK
i am trying to upload the .PDf file File is create correctly but it is not showing content
Nov 29, 2007 03:04 PM|satalaj|LINK
Nov 29, 2007 03:20 PM|Suprotim Agarwal|LINK
Check this link to see how to upload a file using ftp
Nov 30, 2007 04:46 AM|hemangiGujar|LINK
I have uploaded .txt,.doc,.xml file tp ftp with this code
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(CompleteFTPPath + @"/Trial1.pdf");
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("names", "pwd");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader(CompleteLocalPath);
byte fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
response = (FtpWebResponse)request.GetResponse();
lblMsg.Text = "Upload File Complete, status " + response.StatusDescription;
But with same code I have tried for .pdf file to upload. then .Pdf file is create there but it dosnt have content.
If suppose i have 6 page of .pdf file then it shows .pdf file with 6 empty pages
Thanks in Advances
Nov 30, 2007 05:34 AM|Suprotim Agarwal|LINK
I guess the problem is not with the uploading then, but the way you are decoding the pdf data back to be read.
this post to see the solution.
Nov 30, 2007 11:01 AM|hemangiGujar|LINK
Still it is not solved
It will be grateful If u can provide any inputs for solving this.
Thanks in advance
Dec 04, 2007 02:36 AM|Suprotim Agarwal|LINK
Do you have physical access to the server where the files are uploaded. Have you checked the files physically to see if they are empty?
There could be two scenarios :
1. The .pdf gets uploaded correctly and has data, however while reading the file back using a stream, you are not able to view the contents due to improper decoding
2. The .pdf is empty and has been checked physically
Which scenario does your problem belong to?
Dec 04, 2007 04:55 AM|hemangiGujar|LINK
Yes i have a physical access to that ftp server and on server it has been checked out.
But it is empty.
Dec 04, 2007 07:44 AM|Suprotim Agarwal|LINK
Post your entire code over here. May be i will try it out over here and find a possible solution.