Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2006

Tip: Looking for answers? Try searching our database.

WebClient.UploadFile

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 12 Sep 2006 07:47 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.
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.