Restrict File Types
Feb 14, 2007How do i restrict files types that can be accessed when using the input element type file...like the one used when uploading..how do i restrict it to certain files with given file extensions?
View 3 RepliesHow do i restrict files types that can be accessed when using the input element type file...like the one used when uploading..how do i restrict it to certain files with given file extensions?
View 3 RepliesIn JSP / HTML, I want to restrict the size of file being uploaded.
<input type="file" name="myfile"/>
If the user trying to upload a file size bigger than some value say 5MB, i want to give mesage to the user. I don't want to wait till the file gets uploaded to server and then validate the file size. I am looking for client side validation. Can it be done using scripting language or any other way?
Need a solution for this in Internet Explorer. I got a solution using ActiveX control:
var myFSO = new ActiveXObject("Scripting.FileSystemObject");
var filepath = document.getElementById('myfile').value;
var thefile = myFSO.getFile(filepath);
var sizeInBytes = thefile.size;
But ActiveX controls are not allowed in our application. Is there any alternative way for this?
<div class="wrapperAttribsOptions">
This pice of code is dynamically created by my shopping carts admin section which is an attribute for a certain product.
The problem I have is that all the attributes are displayed in an array and positioning each is not possible (well, I have posted a query in another forum with regards to that). I have taken the code, as viewed in the source code, and added it in where I please e.g. radio buttons, checkboxes etc, which function perfectly.
This does make 'duplicate' field but I have used display:none on the generated code which hides it. I have found a snippet of code which fixes issues will type=text fields....
But this can not be done when it comes to type=file.
Once you browse and select your image, i need the directory to be entered into the 'real' field for uploading when submitted.
Basically am working on the travel booking site,i written the lot of ajax scripts , so am little bit fear of that ajax ,becoz if some one tried to access anonymously So i dont want to user access or takeing my javascript fileTell me how to restrict the use get my javascript filecouple of days back i saw on site, in the i take that site js url , and when i typed on the Browser , the system say , you cant view this URL
View 2 Replies View RelatedJavaScript hides its memory structure.
I know that numbers, booleans, null and undefined are value types
(value is directed saved in a variable).
I want to know:
- How JavaScript distinguishes value types from reference types by
seeing the variable content?
- How many bytes are allocated in memory when I declare the following?
var i;
I can program in JavaScript without understanding them.
But I'm curious.
struggling with figuring out how to fill certain types of forms. Here's a SMALL SNIPPET of a form. Parts of it would be VERY convenient if it could be automatically filled when page is loaded. Autofilling text boxes is easy enough. But I need the file box to be auto-filled with "C:/example.txt" when the page loads.
NOTE: typing value="C:/example.txt" does not work .
I want to restrict the user from being entering the value in <input type="file">. It works fine in IE but not in Mozilla. I am sending my code also which works in IE and not in Mozilla...
View 2 Replies View Relatedhave made a homepage with nvu and works good but want to restrict access to all pages except the main page. i want everyone that tries to access a subpage directly to be redirected to the mainpage.
is there any simple way to achieve that ? must be in html or javascript.
I am using IE 6.0. On a page, I have placed a contenteditable div
which I want to use as a Rich Text Area. I am using the execCommand method of
the document to control bold, italics, underlining, and undo for this div.
I have placed an input element on the page to. All but the undo, are
restricted to working only on the div. How can I restrict the undo to
working on only the div?
Below is the complete page so you can see what I am talking about.
Just paste it into an htm file and traverse to it via your browser.
Type something in the div and the input and then try the buttons. Code:
I have a textfield where i would like the user to input only Y or N.
can somebody tell me how can i restrict the user from entering any other character, number or special character.
I am having a table with rows created using a button click event. While adding rows to the table, I create drop dowlist using
Code:
objVehicles = document.createElement("<SELECT class='dropdownbox' id=Vehicles"+objAlertRowId+" name=Vehicles"+objAlertRowId+" STYLE='width:148px'; onchange='setDataChanged();toggleEditButton(" + objAlertRowId+ ",this.value);' >");
objNewRow.cells.item(3).appendChild(objVehicles);
And the output will be like the attached screen shot.
The control name as Vehicles0,Vehicles1 and so on Now I want to restrict that the the user select no duplicates from the List.
What logic I can implement ?
I've a textbox field, where user enters his name. I want to restrict
him from entering double and singls inverted commas.What kind of
function should i write.
I need to restrict an area on the image but also get the coordinates from the image. I am using a form element "input type=image" so I can get the X Y coordinates from an image. I don't want the user clicking on a whole image, in this case a map of a country. I don't want the users clicking off the country's borders in to another country and I want to be able to get the coordinates from inside the country. I have tried to mix the element from the form with the area shape so when someone will click on the image it will first verify if it's over the hotspot and if it's over the poly coords then it will allow the user to click, the form will submit and the coordinates will be stored into the database.
I just don't know how I could integrate javascript into this. This is my code, not really something functional, the coordinates will pass on to the next page as a variable but limiting the area where the users may click is something that I have not figured out. I can create an area shape but without getting the coordinates from the image. Anything will do, even without <input type=image , if there is some way around this so I can make this work.
<script type="text/javascript">
function myEye() {
document.coordform.submit();
}
</script>
<form action='store.php' method=post name="coordform"> .....
I'm currently generating some tooltips to display data for certain items in a game. The tooltips and stats work great, however, for certain items, the tooltip gets long and will extend pass the viewable range for the user.
Here are the links:
test page: [URL]
javascript: [URL]
css (for hover div only): [URL]
If you hover over the links of items (like villages, barracks, etc.) a tooltip will pop up to show you the stats. But if you notice, for items like castles, the tooltip can extend past the viewable range for the user.
Does anyone have code to restrict input of a singli quote and a backslash in input field? I need to make sure this code works in IE, FF, Opera. Well, all major browsers
View 6 Replies View RelatedIs there anyway of restricting the amount of webpages open. I would like users of a site only to beable to have two pages (from the site i am talking about) open at anyone time.
View 1 Replies View RelatedHow do I get the childelements of a div, but only the child elements that are "ahref" tags?
for example:
<div id="someDivID">
<a href="somepath.html">link 1</a>
<a href="somepath.html">link 2</a>
[code]...
I want all the childElements under someDivID that are "a href" types...I am using prototype: I figured the following would work, but didn't.
$('someDivID').childElements.getElementByTagName('a')
I am very able to restrict char length by using substr() but this means that in some cases the word gets cut off in the middle of it.
How can I restrict the char length to the nearest word.
This is where I got to and then went blank?
Code:
if(comparename.length > 18){
if(comparename.substr(0,18) != ' '){
for(var tzx=0;tzx<comparename.length;tzx++){
while(comparename.substr(0,(18-tzx)) != ' '){
[Code]....
I have a Web application and the web resources like jss,css,jquery files are located outside of the WEB-INF directory (Java application) and if some user or hacker change the URL could see the source code for many js and jquery files.
View 4 Replies View RelatedI picked up this Drag n Drop script years ago from the net. Modified it slightly but one mod i cant make work is limiting it to only running when the mouse is over an ID called dragid. Currently a mouse drag anywhere in the browser moves the dragid element which is annoying.
HTML Code:
//Drag and Drop script
if(document.getElementById){
(function(){
//Stop Opera selecting anything whilst dragging.
[Code]...
function aa() {};
var bb = new aa();
var dd = new function cc() {};
aa.prototype.rr = 100;
cc.prototype.rr = 100;
---------------------------------------------------------------
i wrote the code above that makes two functions and two object for
those.
bb(object)<-aa(function),
cc(object)<-dd(function).
i think it's all the same way to make an object for a function.
but if u try to debug,
bb object has rr right after "aa.prototype.rr = 100" statement
but cc deosn't have rr variable.
can anyone explain it why?
Is it possible with jQuery, or JavaScript for that matter, to trap the mouse in a div or other tag so that it can only move around in it. I'd like this for a modal window so thta the user knows that they must do something in the window first before carrying on.
View 2 Replies View RelatedWhen the number of menus (including a menu and its submenus) reach a particular number, then after that rest of the menus are not getting
displayed. Is there any settings available to restrict number of menus in superfish?
I m having trouble restricting an action to a single image. I am trying to make the background fade to full opacity on hover, and have that working like I want to. The problem is that when I hover one image, ALL the images fade to full opacity. Obviously it would be nice to only have the one that is being hovered over. I am sure it is just a simple thing in the code but I just can't figure out what it is.
[Code]...
I was wondering if it is possible to restrict the values of a text input box to only accept set values such as "XBC1". I am trying to make a form for a scanner so you can scan bar codes and it will auto fill the form out and have default values set so incorrect values cant be submitted into the database and mess everything up.
View 4 Replies View RelatedI have a table where the first column is mixed with words and dollar amounts and by default, before you sort, it looks like this:
[Code]...