473,657 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload Issue - INPUT type="file" and Use of .click()

HVG
Hi, does anyone know why using ".click()" on a <INPUT type="file"> control
should be a problem?

- the html file selction control is on a very plain webform page with just
the <input type="file"> control and a submit button.
- the ".click()" method is simply used to automatically open the file
selction dialog box so the user doesn't have to click "Browse". (likewise
the form is automatically submitted when the user selects a file).
The wierd effect is:
- When the user first clicks the submit button (after selecting a file),
the form does not submit, and the file selction input control clears
- If the user now selects a file again by clicking the "Browse" button
manually, the process works just fine.

So I guess the file selction control is not executing something internally
when we simulate a "Browse" button click by envoking the "click()" method.
Any ideas much appreciated.

Regards
Hugo
Nov 18 '05 #1
2 2076
Hi,

For security reasons only the user can explicitly choose files to
upload. Any manipulation to do it by code will not succeed.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
HVG
Aha, that explains it.
Thanks
Hugo

"Natty Gur" <na***@dao2com. com> wrote in message
news:Op******** ******@tk2msftn gp13.phx.gbl...
Hi,

For security reasons only the user can explicitly choose files to
upload. Any manipulation to do it by code will not succeed.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3

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

Similar topics

2
8112
by: Laermans_k | last post by:
Hi, Does anyone have a solution to use the <input type="file" id="filechooser"> and the <input type="submit" id="submitbutton"> in 1 button click? I've already tried to create a javascript function behind the submitbutton click. In this function i call the filechooser.click() event and after this i call the functions to activate the progressbar of the upload. This doesn't seems to work:(
5
3600
by: Mr Gordonz | last post by:
Hi all, I want to put a button on a page, and when the user clicks it, the standard Windows "Open File" dialogue box opens, and the user can browse/select a file on their PC. Having selected a file, the user clicks Open, and I then want to capture the file path and name in a string variable. Finally, I want to upload the file to the server. BUT: I don't want to use an <input type="file"> control.
7
2652
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine if I use the web test interface. It also works fine if I call it from an ASP.NET page that has a text box where the XML is pasted and then passed on. However, I get an exception if I use an <input type="file"> control on the ASP page that allows...
4
10733
by: sakurasyi | last post by:
hai everyone... can i need your help? recently i'm doing a program for upload image or file.. i've attmpted to post the location or path to the page then input it into the form using <input type = "file" value = ${paths} name = "image">, but its not working.. 1. is there a way to upload file without using the browse button? 2. is there a way to upload file using <input type = "file" value = ${paths} name = "image">? thank you.
4
7856
by: Petr Vileta | last post by:
Sorry if my question was be here earlier, I'm new here ;-) I have html form where is the tag <input id="x" type="file" name="upload"> and another fields. After submit script on server take some validation on some fields and if te error is found the same form is generated with error reporting message. But the content of the "file" input is lost. I test it in IE6 and parameter value="???" not work here. I try to put string into input...
2
2887
by: trint | last post by:
With the following code, I get the "message" whether or not there is content in my filefield: function check_file_field() { var file_field = document.getElementById("custCartFile"); if(file_field.value.length == 0) { alert("You are required to select an Image"); return false;
5
34008
by: cssExp | last post by:
alright suppose i have the following. <input type="file" name="upload" /> <input type="text" name="discription" /> <input type="image" onclick="addFile();" src="images/addfile.jpg" name="add" alt="Add file" /> Here when user clicks add button, it gets added dynamically in to a div. Which all good and nice, i have very well done so. But here is the problem, on that parent div there are children, children divs contains the input which...
1
10477
by: .Net Sports | last post by:
I'm using Persits.upload module in ASP, and when i use the following form pointed to the object I've always used, i get a "The system cannot find the file specified" error pointing to the line of my upload.savevirtual : Set Upload = Server.CreateObject("Persits.Upload") upload.savevirtual ("test/") .. ''''error:
6
4118
by: passionateforjava | last post by:
Hi All, I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like: <input type="file" id="uploadFile" name="uploadFile" size="50"> I have the import button on which I have used onClick event to call javascript function submitValues() used to validate all the fields from the page which goes like: <input type="button" name="select" value="Import" class="CSSButton"...
0
8395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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
8732
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
8503
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
7330
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
6166
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
4155
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...
1
2726
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
1955
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.