473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

check file size before post

when I upload a file, I can set in my code not to save it if the file size
is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.

any ideas?
thx
-- using vb.net on asp.net page
Nov 18 '05 #1
6 3127
You can't access the filesysytem on the client unless you want to use java
applets or ActiveX controls.

Eliyahu

"nicholas" <mu********@hotmail.com> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
when I upload a file, I can set in my code not to save it if the file size
is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.
any ideas?
thx
-- using vb.net on asp.net page

Nov 18 '05 #2
hi

you can get your page size
int fileSize = Page.Request.Files[0].ContentLength;
so if your page content is bigger that a value put a message not to upload
the file.

Cheers

"nicholas" wrote:
when I upload a file, I can set in my code not to save it if the file size
is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.

any ideas?
thx
-- using vb.net on asp.net page

Nov 18 '05 #3
this will not work, as the file is already uploaded by this time.

as noted, the only option is an active/x control (java applet will not
work).

-- bruce (sqlwork.com)

"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
hi

you can get your page size
int fileSize = Page.Request.Files[0].ContentLength;
so if your page content is bigger that a value put a message not to upload
the file.

Cheers

"nicholas" wrote:
when I upload a file, I can set in my code not to save it if the file size is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.
any ideas?
thx
-- using vb.net on asp.net page

Nov 18 '05 #4
yes, your are right. only with activex can find on client machine the file
length.

"bruce barker" wrote:
this will not work, as the file is already uploaded by this time.

as noted, the only option is an active/x control (java applet will not
work).

-- bruce (sqlwork.com)

"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
hi

you can get your page size
int fileSize = Page.Request.Files[0].ContentLength;
so if your page content is bigger that a value put a message not to upload
the file.

Cheers

"nicholas" wrote:
when I upload a file, I can set in my code not to save it if the file size is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.
any ideas?
thx
-- using vb.net on asp.net page


Nov 18 '05 #5
ok, thx everyone !

"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
yes, your are right. only with activex can find on client machine the file
length.

"bruce barker" wrote:
this will not work, as the file is already uploaded by this time.

as noted, the only option is an active/x control (java applet will not
work).

-- bruce (sqlwork.com)

"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
hi

you can get your page size
int fileSize = Page.Request.Files[0].ContentLength;
so if your page content is bigger that a value put a message not to upload the file.

Cheers

"nicholas" wrote:

> when I upload a file, I can set in my code not to save it if the file
size
> is too large.
> But then the user has allready been waiting a few minutes to upload
his > file, as this can only be controlled once it is uploaded.
>
> I would like to say to the user the file is too large before it

uploads it.
>
> any ideas?
> thx
> -- using vb.net on asp.net page
>
>
>


Nov 18 '05 #6
Nicholas,

The machine.config file defines the <httpRuntime> element that can be
used to control the max file size. For example,

<!-- set max size to 60 megs and max timeout to 60 minutes -->
<httpRuntime executionTimeout="3600" maxRequestLength="61440" />

You can override this in your own application's web.config file so
that it only affects your application and not all applications.

If a user attempts to upload a file greator than the max size, the
browser will immediately give the user an error message.
Unfortunately the error message is not user friendly. If you can live
with that, that is the easiest thing to do.
sayed
"nicholas" <mu********@hotmail.com> wrote in message news:<ue**************@TK2MSFTNGP11.phx.gbl>...
when I upload a file, I can set in my code not to save it if the file size
is too large.
But then the user has allready been waiting a few minutes to upload his
file, as this can only be controlled once it is uploaded.

I would like to say to the user the file is too large before it uploads it.

any ideas?
thx
-- using vb.net on asp.net page

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: vishal | last post by:
hi is there anyway that i can check the size of file on client side before uploading file to server???? suppose the user uploads file of 10 mb then the server will know the size is 10 mb...
3
by: Matt | last post by:
The user can select a file in the file open dialog using <input type="FILE">, but the user can also enter the full file path in the browse text box manually. My question is if there are JavaScript...
2
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there...
2
by: yonthebeach | last post by:
hi, i have an upload mechanism on my website and want to check the filesize on the client size. is this possible? thanks yavuz bogazci
5
by: Paolo | last post by:
Hi all! I have to create an application that receive some packet from an interface and builds a file from those. In the header there are three fields: one is the total lenght of the file, one is...
3
by: puja | last post by:
hi all, In asp.net 2.0 there is a limit on file size upload of 4MB. I know this limit can be increased in web.config file. Is there any way to check the file size before upload ? if user is...
2
by: Mike | last post by:
Hello, I have a page that uploads a file. It has a form and uses SELF to process the file the second time around. I have MAX_FILE_SIZE set. The problem is, if the file is too big I cant check...
13
by: marfola | last post by:
I’m trying to find the file size using javascript, before it get uploaded into the server using the following Javascript (I don’t want to use ActiveX because of compatibility problem). function...
3
Frinavale
by: Frinavale | last post by:
Hi there! I'm hoping that someone knows how to check the size of a file before it is uploaded to the server using JavaScript. I have seen suggested solutions using an ActiveX control to check...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.