473,749 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload File Size


I am using <INPUT id="File1" type="file" name="File1" runat="server"t o
upload file to the server.

My Questions:
1. Is it possible to check the file size before the file is uploaded other
than using
Scripting.FileS ystemObject ?

2. If answer to 1 is no, is it possible to check in the server side the
Request.Content Length and prevent the exception/ blank page if the file size
exceeds the value in <httpRuntime maxRequestLengt h="4000" />. Ie Stop the
http request and show the previous page. I do not want to refresh the page as
there may be some data in the submitted page which should not be cleared.

3. If answer to 2 is no. I can set a very large value in <httpRuntime
maxRequestLengt h="400000000" />. If the contentlength is large is there a way
in the server side to stop the upload and show the user submitted page with
an error message.

--
Thanks
asiva
Oct 18 '06 #1
2 1822
1. File size cannot be checked on the client-side as there is no way to
access the local file system from a web page

2 & 3: Information about the file uploaded in only available after the
complete file content has been uploaded and hence upload cannot be stopped
in the middle.

"asiva" <ar*******@apri so.comwrote in message
news:41******** *************** ***********@mic rosoft.com...

I am using <INPUT id="File1" type="file" name="File1" runat="server"t o
upload file to the server.

My Questions:
1. Is it possible to check the file size before the file is uploaded other
than using
Scripting.FileS ystemObject ?

2. If answer to 1 is no, is it possible to check in the server side the
Request.Content Length and prevent the exception/ blank page if the file size
exceeds the value in <httpRuntime maxRequestLengt h="4000" />. Ie Stop the
http request and show the previous page. I do not want to refresh the page
as
there may be some data in the submitted page which should not be cleared.

3. If answer to 2 is no. I can set a very large value in <httpRuntime
maxRequestLengt h="400000000" />. If the contentlength is large is there a
way
in the server side to stop the upload and show the user submitted page with
an error message.

--
Thanks
asiva

Oct 18 '06 #2
Due to security restrictions the only way to provide a rich upload
experience like you describe is for the user to install a rich client of
some kind that can access the file system, such as an ActiveX control or a
windows forms app or control of some kind that has the necessary
permissions.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"asiva" <ar*******@apri so.comwrote in message
news:41******** *************** ***********@mic rosoft.com...
>
I am using <INPUT id="File1" type="file" name="File1" runat="server"t o
upload file to the server.

My Questions:
1. Is it possible to check the file size before the file is uploaded other
than using
Scripting.FileS ystemObject ?

2. If answer to 1 is no, is it possible to check in the server side the
Request.Content Length and prevent the exception/ blank page if the file
size
exceeds the value in <httpRuntime maxRequestLengt h="4000" />. Ie Stop
the
http request and show the previous page. I do not want to refresh the page
as
there may be some data in the submitted page which should not be cleared.

3. If answer to 2 is no. I can set a very large value in <httpRuntime
maxRequestLengt h="400000000" />. If the contentlength is large is there a
way
in the server side to stop the upload and show the user submitted page
with
an error message.

--
Thanks
asiva

Oct 19 '06 #3

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

Similar topics

3
11762
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
2
6063
by: Tom Wells | last post by:
I have a little file upload page that I have been able to use to successfully upload files to the C: drive of LocalHost (my machine). I need to be able to upload to a network drive from the intranet server. On the line: dirs = Directory.GetDirectories(currentDir) I get "Access to the path "\\les-net\les\Special Projects\ATSPDF" is denied." How do I get the GetDirectories command to user my user ID and password when it tries to hit the...
1
2763
by: BW | last post by:
I am creating an upload/download function for an extranet site. Files will be uploaded to directory based upon the users login and associated project. The function works as long as I use "c:\Temp" as the directory. When I use any other hard coded directory or even Server.MapPath() the upload function fails and returns the error: "Exception has been thrown by the target of an invocation." Once I change the root directory to "c:\Temp",...
0
4753
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle verdiği hata şu.Bilen arkadaşlar lütfen yardım edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. /classifieds/upload.asp, line 250
1
2138
by: Marko Vuksanovic | last post by:
I used the following code for implementing a file upload progress indicator, using UpdateProgress Panel, though I have a problem that FileUpload.Has File always returns false. Any suggestions what might be wrong? FileUpload2.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileUpload2.aspx.cs" Inherits="FileUpload2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
9
20898
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at rapidshare news : http://images.rapidshare.com/software/rsapi.pl If you test it you will see that you can upload one file at time. I try to modify it in that way that script can read a text file with the names of the files i want to...
0
9802
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
2
2159
by: Event Horizon | last post by:
Hi, I'm trying to add an simple upload applet to shopping cart script. My new applet form sends all needed post fields ( quantity, product, etc... ) but the "file" post field is hardcoded in applet. Shop script works with : <input type="file" name="id"/> but not with applet's: <input type="file" name="SourceFile_1"/> I just cannot figure out how to fix this :(
2
7651
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in the db-file-to-disk.asp file, what I want to do is the user has to field out this fied before...
5
3289
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is _uploadedfiles_xxxx) (php must be allowed to move uploaded files to this folder' - uploadedfiles_xxxx. I typed <?php chmod ('_uploadedfiles_xxxx',640); ?> into notepad and saved it as php in the uploaded_xxxx folder, when I went to test it, the error...
0
9568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.