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)
http://IP/Proxy.php?someparam=val&moreparams=val2
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.
Daniel - 12 Sep 2006 23:40 GMT
Dunno how much use this will be but here's the php code which deals with the
file.
// 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 );
Cristian - 18 Oct 2006 10:23 GMT
> 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.
[quoted text clipped - 13 lines]
> There is an incompatibility between php and .net versions blah, blah, but I
> can't seem to find anything like that.
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.topxml.com/renntp using reNNTP: the website based NNTP reader.