Post by RGFuaWV » Wed, 13 Sep 2006 15:47:01

As you may have guessed I'm trying to upload a file to a php server using the
WebClient.UploadFile function, however the function never returns.
Instead it chews up memory (fairly slowly) until it eventually runs out of
memory then throws an assert saying out of memory.
The file is about 400kb, and the code is what you would expect.

This is the function that never returns

webClient.UploadFile( otherUrl, "POST", "UploadedScreenShot.jpg" );

The URL looks like this (I can't actually give you the real one)


What I'm expecting is something like:
There is an incompatibility between php and .net versions blah, blah, but I
can't seem to find anything like that.


Post by RGFuaWV » Thu, 14 Sep 2006 07:40:02

Dunno how much use this will be but here's the php code which deals with the

// save the file to a new location
$uploaddir = "./tempuploads/";
$uploadfile = $uploaddir . basename( $_FILES["file"]["tmp_name"] );
move_uploaded_file( $_FILES["file"]["tmp_name"], $uploadfile );

// load the file into the file structure

$readFile = fopen( $uploadfile, "rb" );
while ( feof( $readFile ) == false )
// read 2048 bytes at a time till we get to the end
// NOTE this number is just one I choose
// the number needs to be less then 8148 (I think)
// because thats the maximum limit of the fread function in PHP
$tempMem = $tempMem . fread( $readFile, 2048 );
fclose( $readFile );



Post by Cristia » Thu, 19 Oct 2006 18:23:20

I have aproximatively the same problem with WebClient.UploadFile method.
I've build a service that basically has to upload some files to a Http server.
Problem is if the file has 200MB for ex. it will eat up ~200MB of memory while uploading, and.....after upload is finished, memory remains aloccated.
Of course, you can imagine what happens if i try to upload several big files...

I've tried Dispose() - doesn't work
I've tried async call - doesn't work

Posted from http://www.yqcomputer.com/ : the website based NNTP reader.