LxFTPRequest icon indicating copy to clipboard operation
LxFTPRequest copied to clipboard

Upload PDF file not successful

Open tranngoclinh88 opened this issue 10 years ago • 6 comments

I tried uploading a pdf file to my ftp server. Application notify that uploading is successful but I can not open the uploaded file and uploaded file size is small than local file.

tranngoclinh88 avatar Jan 11 '15 10:01 tranngoclinh88

Thank you for your attention. Maybe my notification has some error, and the phenomenon you see is because of the network problem. I'm busy recently, I want to fix it some other day. Thanks for your supporting again !

DeveloperLx avatar Jan 12 '15 01:01 DeveloperLx

This happens with even a regular ~10KB png file.

gurinderhans avatar Mar 24 '15 05:03 gurinderhans

It's OK with png file.

tranngoclinh88 avatar Mar 24 '15 07:03 tranngoclinh88

I went in and started logging bytes written vs read and those things. All those seem fine however my png file that is 7118 bytes only gets uploaded up-to 4520 bytes. Another image 226595 bytes, only 141000 bytes get uploaded. But the weird thing is the logs show everything well. I will try looking more at the source code myself later but it'd be great if a fix could be put up :D

gurinderhans avatar Mar 24 '15 08:03 gurinderhans

Seems like calling [request stop]; in the condition (bytesRead == 0) causes this issue, as this closes the stream but all of the data still hasn't been uploaded yet.

Why does this not get called? kCFStreamEventEndEncountered The whole problem would be solved then. Until then I'm manually gonna have to close the stream from somewhere.

gurinderhans avatar Mar 24 '15 19:03 gurinderhans

I was also getting randomly truncated uploads until I found the magic line to remove:

679: CFWriteStreamSetProperty(self.writeStream, kCFStreamPropertyFTPAttemptPersistentConnection, kCFBooleanFalse);

After commenting out this line, all my uploads appear to be complete.

dolce-ardore avatar Aug 25 '15 05:08 dolce-ardore