Results 1 to 4 of 4

Thread: Filestream Upload

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Unhappy Filestream Upload

    Hi guys,

    I'm stuck with uploading obtaining a Stream. I'm putting the file with Filestream and it works great when files are smaller than 1gb.

    I tried changing buffer size ... but no luck. If you could give me an advice, that would be great.

    The crucial code is here. I did leave behind other parts of the code that are not essential and it would just make this part of the code harder to read.


    Code:
    Dim wr As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
    ' NON LATIN char - >  "multipart/form-data; charset=UTF-8; boundary=" + boundary;
    wr.ContentType = Convert.ToString("multipart/form-data; boundary=") & boundary
    wr.Method = "POST"
    wr.KeepAlive = True
    wr.Credentials = System.Net.CredentialCache.DefaultCredentials
    
    
    
     Dim rs As Stream = wr.GetRequestStream()
     Dim FS As New FileStream(File_Path, FileMode.Open, FileAccess.Read)
    
    Dim buffer As Byte() = New Byte(1024) {} 
    Dim bytesRead As Integer = 0
    
    Dim count As Integer = 0
    While (InlineAssignHelper(bytesRead, FS.Read(buffer, 0, buffer.Length))) <> 0
                  rs.Write(buffer, 0, bytesRead)
                  count += bytesRead
                  Worker.ReportProgress(11, count)
    End While
    
    FS.Close()

    Cheers!
    Last edited by batori; May 14th, 2014 at 02:36 PM.
    Thanks for helping me out.

  2. #2
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    Re: Filestream Upload

    Maybe it is a limit put by host?!.
    God, are you punishing me because my hair is better than yours? -Jack Donaghy

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: Filestream Upload

    I tried several...and im sure it has limit up to 2gb. I tried 4 hosts too.

    I've seen bytes count and then stop ... drop ... and again go up ... i mean memory just building up and going down ... but only when files are bigger than 1gb

    The bigger the file the bigger the chance of not succeeding in uploading....

    Never had problem with small files...up to 300mb.

    EDIT:

    i noticed, since im counting the bytes (converted later to mb) with
    Code:
    Worker.ReportProgress(11, count)
    that after it reaches 900mb the count shows something like 39. or 52 ... and it hangs.
    Last edited by batori; May 15th, 2014 at 12:10 AM.
    Thanks for helping me out.

  4. #4
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Filestream Upload

    so you said you played with the buffer right? this part
    Code:
    Dim buffer As Byte() = New Byte(1024)
    also you are posting data, maybe as before the limit is set to 1gb, do you have access to the settings of the remote server?
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width