473,813 Members | 3,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

uploaded file-size validation

sumittyagi
202 Recognized Expert New Member
If we want to upload file, we you the tag:
<input type="file" name="fileName"/>

Now is it possible to get the size of the uploaded file before submitting it.(at onsubmit)

or we would have to do that at server side only.
Mar 5 '07 #1
4 6322
acoder
16,027 Recognized Expert Moderator MVP
Welcome to The Scripts.

You've just joined and you're getting stuck in - it's good to see!

One thing is you should not double post. Actually, starting a new thread as you have done is here was the correct way to go.

The answer to your query which I answered in the other thread too is that only IE supports the fileSize property.

In any case, you will need server side code for file size checking in case someone disables javascript or uses some other method to bypass your security checks on the client-side.
Mar 5 '07 #2
sumittyagi
202 Recognized Expert New Member
Welcome to The Scripts.

You've just joined and you're getting stuck in - it's good to see!

One thing is you should not double post. Actually, starting a new thread as you have done is here was the correct way to go.

The answer to your query which I answered in the other thread too is that only IE supports the fileSize property.

In any case, you will need server side code for file size checking in case someone disables javascript or uses some other method to bypass your security checks on the client-side.

Thanks for your reply acoder. And I am sorry for double posting! I will remember this in my future posts.
Mar 5 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Thanks for your reply acoder. And I am sorry for double posting! I will remember this in my future posts.
No problem.
Mar 5 '07 #4
sparkyfied
1 New Member
Sorry to throw a spanner in the works...

As far as I am aware, once the file has been selected you can do an onchange event on the file field, create a image object in js, give the image object the source (in the file field) .src, and then do some tests using javascript. You should be able to attach an onload event to the image to check it's loaded before getting the heights and widths, although I'm not sure if that is frowned upon these days.

Hope that helps.
Mar 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1852
by: ketulp_baroda | last post by:
Hi I want to determine the content type of uploaded file. File was uploaded by using <input type=file>. How can I determine the content type?
0
2223
by: Mark | last post by:
Hi all, I want to be able to resize an image that a user has uploaded. I have the image upload working as well as the image resize. When I go to delete the original uploaded file (I want to replace the uploaded file with the new resized version) I get a "file being used by another process" error. I therefore cannot replace the uploaded image with the new thumbnail. How can I get around this???
8
2798
by: Al Knowles | last post by:
I have researched and tried every method I can find for passing a two-page tif file from a VB6 application to a web service via XML. These include XMLTextReader.ReadBase64, Convert.FromBase64, and using the Binary Writer. When the web service stores the file, the length is the same as the uploaded length. Double-clicking on the file before it is uploaded will display it in an image preview application. Double clicking on the newly...
1
6935
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working with uploaded MS WORD .doc files. Using code like that below: strLine = sr.ReadLine While Not IsNothing(strLine) 'Not eof If Trim(strLine) <> "" Then 'Not blank
5
2737
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
4
2422
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of uploading files on a server. I am uploading files from a page upload.asp which has a link on default.asp. Now my problem is that, how can i send the file name that is uploaded, in a mail along with other details that the user enters on default.asp?? In...
6
4334
by: Kimmo Laine | last post by:
Running IIS 6 on Windows 2003 server. After an update to the most recent version of php 5.1.2, for some reacon a function handling uploaded files using is_file stopped working. is_file failed for existing files. I fixed it by changing is_file to file_exists, then it worked again. Prior to the update, in the older version, presumably it was 5.0.1, is_file worked just fine without problems. <?php
2
1268
by: Greg | last post by:
I need to create an aspx page that accepts an uploaded text file from a user and parses the file contents into various, normalized database tables/columns. The input file is an industry standard, fixed-width file layout. The file is 'old-school' with the first three columns representing a segment code that identifies what fields and positions exist on the line, so it's not just a straight-forward fixed width text file. I have toyed with...
2
1560
by: Muddasir | last post by:
Hi All. Anyone plz tell me how can I upload a file with the file name of my choice. am having problem with this, the file got uploaded but not with the name I wanted to...how can I do this ....please tell me. Here is the code: <html> <head>
14
1851
by: Jeigh | last post by:
Hello, I'm going to start making a script that will allow users to upload a file, then re download it later. I'll basically be doing the following: - The uploaded file will be given a string of random numbers / letters as the filename and uploaded to a folder. - That random file name will be stored in the database along with the users username - When the user logs in they will see a list of their files that they can download and they...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10667
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...
0
10407
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10422
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
9222
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...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5705
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.