Showing posts with label size. Show all posts
Showing posts with label size. Show all posts

Wednesday, March 28, 2012

Installed AJAX - cannot upload large files

Hello there.
I have an issue with file size to be uploaded that happened only after I installed AJAX.

So before installing AJAX on the web server, we did set on the web.config of our application the following value
<httpRuntime maxRequestLength=30000 /> which did allow us to upload files up to 30 MG.

After we installed AJAX, it seems that we are not capable to upload large files again.

Do you know if AJAX installation may override somehow that value somewhere else?
The web.config of our application still has the 30000 entry ...but it is obviously not working any longer.

Filippo

If the file upload is now inside an ajax control, it may be that you're hitting a script-timeout (i.e. XMLHTTPREQUEST times out before the whole file can be uploaded.)

You're best bet would be to run the file upload outside of an ajax control - i.e. as a proper postback.

p.s. It should be 30720 for 30 MB - in case you're publishing the maximum size it could confuse people.


thank you , but I'm not using AJAX in my upload page

I use just put Scriptmanager in the master page/? is this makes problems ?

by the way it was working well up to 10MB but when I changed the server it upload the file with 0kb even it's 5MB

so is this mistake of server (it's local server indeed) I want to be ensure that the code is ok

here is my upload function

1public string DoImport(FileUpload myFileUpload)2 {3string ServerPath ="";4string webServerFilePath ="";5try6 {78string filepath = myFileUpload.PostedFile.FileName;910if ((filepath !=null) & (filepath.Length != 0))11 {12 FileInfo finfo =new FileInfo(filepath);13string filename = finfo.Name;14//save file on the webserver machine1516 StringBuilder bufWebServerFilePath =new StringBuilder(240);17string tempImportFldr =18 Server.MapPath("~\\"19 + ConfigurationManager.ConnectionStrings["TempAttachPath"].ToString());20 bufWebServerFilePath.Append(tempImportFldr);21if (tempImportFldr.EndsWith("\\") ==false)22 {23 bufWebServerFilePath.Append("\\");24 }25 bufWebServerFilePath.Append(Session.LCID.ToString() + filename);/*to make file unique*/26 webServerFilePath = bufWebServerFilePath.ToString();272829if (File.Exists(webServerFilePath))30 {31 File.Delete(webServerFilePath);32 }3334 myFileUpload.SaveAs(webServerFilePath);3536 ServerPath = webServerFilePath;37 }383940 }41catch (Exception Ex)42 {43////this code is to write in a log file(Optional)44 CreateLogFiles.CreateLogFiles Err =new CreateLogFiles.CreateLogFiles();45string path = Request.PhysicalApplicationPath.ToString();46 Err.ErrorLog(Request.PhysicalApplicationPath.ToString() + ("Logs/ErrorLog"),"(" + ServerPath +")DoImport->(internal memo)" + Ex.Message);4748 }495051return ServerPath;52 }
the error message comes in line (36) ->Cannot access a closed file.
so any help please 
thanks in advance 

Well , I got it worked by adding this line in my web.config

<httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="250000" requestLengthDiskThreshold="250000"/>

Saturday, March 24, 2012

Is 242 KB atlas download too huge .... huge... for you?

Atlas make life easier at the same time make user experiences harder with huge atlas script.

1. There are several ways to reduce the size by setting EnableScriptComponents=false. It still come down to 56kb.

When EnableScriptComponents=false, the webservices bridge will not run, any body know which component need to be included to make it run?

2. Anything that can make the javascripts become 20kb?

J

hi,
i ran into this issue a couple of weeks ago and was somewhat concerned that pages I was creating for a site may start to run to 500k or something. which was worrying to say the least. after a good deal of searching (as it still early days i suppose) i discovered that:
1/ if you are using visual studio / visual web devloper or whatever, and you have debug=true in you web config, this will prevent the atlas javascripts from getting cached on the client browser. when set to false (ie release) the scripts will be cached on the first time any page utilising the atlas framework is called. All subsepquent page loads etc will then be quicker.
2/ add this to your web config under the httpModules nodes
<add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>
the download size for all pages running atlas controls etc will be significantly reduced and no settings are disabled.