Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 18th, 2008, 04:58 AM
Authorized User
Join Date: Mar 2008
Location: Ahmedabad, Gujarat, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem to upload file

hi friends

i am using FileUpload control to upload file but when i trying to upload file which size more than 50mb it is showing me error. Can anybody help me to solve this prob? i have also tried ftprequest object it is uploading 100mb files but sometime it is showing me buffer full error so how i can manage it?

  #2 (permalink)  
Old March 25th, 2008, 07:36 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

There are 2 things at play when you are trying to upload files via the FileUpload control related to ASP.NET. By default you can only upload files that are 4MB in size; to overcome this you need to change the value of the maxRequestLength attribute in your Web.Config (In your case the value should be something like 51200). Moreover the bigger a file is the longer it is going to take to push from a clients machine to the webserver so you also will need to look at the executionTimeout property so that you do not have a timeout between the server and client during the upload.

Also, if you are using IIS 7 it has a 30MB cap on file uploads. This blog details how you would go about changing that value: http://weblogs.asp.net/steveschofiel...e-in-iis7.aspx

In so far as your buffer full error, I assume that you are mismanaging the file stream as it comes into you application although I have no other advice outside of that.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
  #3 (permalink)  
Old March 26th, 2008, 04:37 AM
Authorized User
Join Date: Mar 2008
Location: Ahmedabad, Gujarat, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for your reply.

I have already made this change in web.config file like this :

<httpRuntime executionTimeout="3600" maxRequestLength="128000" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>

then also this is not working

for second error(buffer full) i am sending code just look at it :


 Public Sub uploadFileUsingFTP(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String, Optional ByVal UName As String = "", Optional ByVal PWD As String = "")

        'Create a FTP Request Object and Specfiy a Complete Path

        Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath)

        'Call A FileUpload Method of FTP Request Object

        reqObj.Method = WebRequestMethods.Ftp.UploadFile

        'If you want to access Resourse Protected You need to give User Name and PWD

        reqObj.Credentials = New NetworkCredential(UName, PWD)

        reqObj.Proxy = Nothing

        'FileStream object read file from Local Drive

        Dim streamObj As FileStream = File.OpenRead(CompleteLocalPath)

        'Store File in Buffer

        Dim buffer(streamObj.Length) As Byte

        'Read File from Buffer

        streamObj.Read(buffer, 0, buffer.Length)

        'Close FileStream Object Set its Value to nothing


        streamObj = Nothing

        'Upload File to ftp://localHost/ set its object to nothing

        reqObj.GetRequestStream().Write(buffer, 0, buffer.Length)

        reqObj = Nothing

    End Sub

    Protected Sub cmdUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpload.Click

        uploadFileUsingFTP("url", "path", "uid", "pwd")

        lblMsg.Text = "File Uploaded Successfully :)"

    End Sub


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload File problem khb3283 ASP.NET 2.0 Basics 1 October 3rd, 2008 01:14 PM
File Upload Problem meetravig Pro JSP 0 July 14th, 2007 01:34 AM
strange file upload problem dan195 ASP.NET 1.0 and 1.1 Basics 0 January 28th, 2007 12:36 AM
Multiple file upload problem suchita_sindhu .NET Framework 1.x 0 September 8th, 2006 03:06 AM
File upload problem! Ashleek007 Beginning PHP 0 July 15th, 2005 11:08 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.