|
Hi everyone!
I have a webpage that allows a user to upload a file for storage in a database. However, I am having a problem when users try to upload a bigger file (usually 3MB+). I am assuming that this is because I am trying to send the entire file to the server at once How can I get around this?
Any help is greatly appreciated
|
|
|
|
|
could it be that since the file is so large/connection is so slow, the operation times out?
as to get around it, you could have the file rar'ed (like a zip) which will zip it up into pieces and then send the pieces bit by bit. Also, try compressing the file so that it gets smaller.
If not, use FTP connection instead of form based.
|
|
|
|
|
jeweladdict wrote: could it be that since the file is so large/connection is so slow, the operation times out?
I am assuming so.
Adding a rar or zip to the file might help but it is not something that i really want to do. Is there a way that you know of that I can send the file to the server in pieces?
Thanks
|
|
|
|
|
ftping would be the best bet.
|
|
|
|
|
Ok thanks i'll give that a try
I also have a another question... Is it better to save the file to a database on the server or right on the disk?
|
|
|
|
|
That depends on how you are going to use the file.
---
b { font-weight: normal; }
|
|
|
|
|
There's a limit on the size of a request, I believe it's 4 MiB by default. Could it be that? Then you can change the limit in web.config.
---
b { font-weight: normal; }
|
|
|
|
|
Thats news to me How would I make those changes?
Thanks
|
|
|
|
|
Look up MaxRequestLength.
---
b { font-weight: normal; }
|
|
|
|
|
|
I've got a half dozenish identical copies of an imagelist in different forms of my app. To avoid having to make changes to each of them if it was modified I want to move them into a single location and share it between all the forms. To have design time support for the data I derived the wrapper class from System.ComponentModel.Component. I then copied the ImageList from one of the existing forms. The images, and the related data in the class is all global/shared so I made the class static and made the neccesary type changes to the declaration and InitializeComponent().
Initially everything worked great, prior to checking the source in however I renamed the imagelist to something more appropriate for general use (old name was targeted at the form I copied from). At that point, VS zapped the imagelist and it's contents into oblivion. I did a bit of experimenting afterwards, and found that any component I add to the design page and then make static is removed after the next build.
Is there any way to make VS leave the static components alone? If not, I can add a static SetImageList(...) method, keep the imagelist in the class with my Main() method, and have it's constructor do the initialization, but this feels like a kluge and I'd prefer a more graceful approach if possible.
|
|
|
|
|
I have a form with 20+ text boxes and other controls that get configured by the user at startup. Is there anyway to save the state that every control is in, including the text in the text boxes so that the user can load them later? I was messing around with serialization of the form, but I can't seem to get that to work.
Thanks!
|
|
|
|
|
Why don't you save your values to a xml file or a database and then retrive them from there?
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
wouldnt that be the same as writing it to a text file? What benefits are there to the xml file, and is there an easy way of doing it?
I know with datagrids you can do the writeXML command, is there soemthign similar?
|
|
|
|
|
Search this site for XML tutorials. It is quite simple once you get a hang of it...
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I guess what I'm looking for is a function that will let me do a
foreach( control in form )
{
save all properties of control to file
}
or a Save state of form function
|
|
|
|
|
Hi,
Are there any ways to get Event Log information from a remote box other than with the EventLog class? EventLog dumps the entire collection of entries, for the specified log, as soon as it's opened. There is no way to throttle it, Read Next, or filter on anything besides "Source". The buffer size appears to be set at 40,000 and I don't see any way to change that (not that I'd want to). Everything was going great until I tried to get a a rather large log. And of course, the solution has to be entirely from the client side and I have no control over the size of the remote server logs.
Any suggestions would be appreciated.
Will
|
|
|
|
|
Hi All,
First I must say that I know absolutely nothing about coding in C#, I come from a C++ background which makes life a little easier. Now I am trying to implement a .net dll into a C++ project. It is a sourceforge project wich can be found here[^], v1.1.6 . Obviously I have to do this via the COM.
I have been trying for a while now to do this, creating type libraries, registering the assembly etc... I have now got my hands on a C# compiler so I can try to make it com compatible. At the moment I am unable to create an instance of the class. So I need to know what changes do I need to make?
If anybody could assist me with this I will be your friend forever
|
|
|
|
|
Hi there : )
This may be the article you're looking for: http://www.codeproject.com/dotnet/cominterop.asp#GenTLB[^]
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Wow, thanks for the quick reply. The link you provided is sure to be a good read, though after scanning through it I noticed that (in true CP tradition) the examples are simple, and nothing like what I am looking at.
using System;
namespace Net.SourceForge.Koogra.Excel
{
public interface IExcelObject
{
Workbook Workbook { get; }
}
} The first thing I notice with this code is public interface IExcelObject , I'm not sure exactly what it is but I see it mentioned a few times throughout the code and is treated much like a base class (in C++). Also it is returning a workbook reference, which I am sure is a no-no with com.
From what I can tell this is the main class
namespace Net.SourceForge.Koogra.Excel
{
public class ExcelObject : IExcelObject
{
private Workbook _wb;
public ExcelObject(Workbook wb)
{
if(wb == null)
throw new ArgumentNullException("wb");
_wb = wb;
}
public Workbook Workbook
{
get
{
return _wb;
}
}
}
} I see here there is no default constructor, so I added one thinking everything would be good and dandy, but nada, didn't fix the problem.
Now I am thinking, rather than trying to change this code, to create a wrapper instead. But with it being C# and my exeptionaly low IQ I'm not sure where to start.
-- modified at 14:15 Thursday 13th April, 2006
I just realised, I didn't state that this code is not my own, and belongs to Superaso[^].
|
|
|
|
|
Hi WalderMort (nice nick - by the way )
I believe you are right, that for COM interop to work you need a default constructor. And the short description of an interface is a contract. It defines the methods of a class that any derived class must implement. The interface itself contains no implementation (no code), just a description of what you have to code in (in this case an IExcelObject) the class that promises to implement the interface. The neat thing about an interface is that you can treat any class that fulfills the needs of the interface as that specific type, regardless of what the parent class is. (It's another way of overcoming the shortcomings of single inheritance in C# as opposed to C++).
The syntax (as you've noticed) is the same as for inheritance:
[classname] : [interface]
The ExcelObject looks as if it's just a wrapper around the WorkBook - is that the wrapper you are talking about?
The "no-no in COM" you are talking about is that the reference. Is it only valid with value-type parameters in COM?
- You're welcome to paste a bit more code and/or errormessages, I think it will help.
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Hi, thanks for your help with this matter. I would post more code but to be honest, there is far too much of it to post.
I now understand the meaning of interface thanks to your explanation.
The way this code differs from examples is that there is more than one class. ExelObject is a base class for many others (font, worksheet, cell..). I'm not sure how this works in C# but but in C++ creating an object of a derived class would also create a base class. The other problem is that most of the classes have no default constructor (i.e. constructors take arguments) which cannot be used in com.
So far I have tried creating a default constructor and renaming the previous to be a function. This is allowing me to create an instance of ExcelObject from C++, but I am now unable reference the renamed function. From the producer:
com visibility is not set on any type
Isn't it enough to declare a function as public?
It looks like I am going to have to make many changes to the sources of this project in order for it to be com compatible. I'm starting to think it would be easier to port the functions I need to C++.
|
|
|
|
|
Hi Waldermort
By default nothing is visible to COM from .net.
But it is easy to make it the default. This can be done at three different levels:
- the Assembly (basically the codepackage, or in many cases, the DLL)
- a class
- a method
So if you declare the Assembly ComVisible, then all the classes inside, and their methods are by default visible.
Declaring something visible to COM is done using attributes in .net (a form of metadata).
You set this in the AssemblyInfo.cs file by:
- importing the namespace System.Runtime.InteropServices by declaring
using System.Runtime.InteropServices at the top of the file.
- somewhere add the line
[assembly: ComVisible(true)]
Hope this helps
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Hi All,
Could any of you kind folk give me some tips on this quandry?
I'm designing an application that will need to access a database. Having learnt about the benefits of OOP I've decided to manage the database with a DataAccess class, rather than have each object access the database independently. However, I'd only want to have one DataAccess object instantiated within the application - so my question is "how can I make the DataAccess object visible to each object within the application".
Any advice appreciated!
-- modified at 13:28 Thursday 13th April, 2006
|
|
|
|
|
This design pattern is commonly called the Singleton, so you can look up some more information if you want. The easiest way is to make the class Public Static. That way all the functions inside the class can be called without creating an instance of the class, emulating one global, Application-wide instance.
|
|
|
|