I have a simple form that does nothing more than let the visitor
choose an image from their hard drive, and then upload it to the
server. It doesn't have any other fields than the <input
type="file"...f ield and, currently, a submit button. It's really
part of a larger form, but it's called in as an iframe so it's
technically a stand-alone form.
My question is, is it possible to submit the form as soon as the image
is selected, so that they won't have to click the Submit button? I
started playing with it and can probably make it work with onBlur, but
that's not exactly right because it still requires that second click
of the mouse.
TIA,
Jason 2 2568
On Jan 5, 2:50 pm, Jason Carlton <jwcarl...@gmai l.comwrote:
My question is, is it possible to submit the form as soon as the image
is selected, so that they won't have to click the Submit button?
From the usability point of view it is a questionable approach: people
are making wrong selection and it is nicer to leave for the them a
chance for the last moment correction. Nevertheless you are the boss.
You may use onchange event handler:
<form method="POST" action="upload. cgi" enctype="multip art/form-data">
<input type="file" name="file01" onchange="this. form.submit()">
<noscript><inpu t type="submit" value="Submit"> </noscript>
</form>
On Jan 5, 10:50*am, VK <schools_r...@y ahoo.comwrote:
On Jan 5, 2:50 pm, Jason Carlton <jwcarl...@gmai l.comwrote:
My question is, is it possible to submit the form as soon as the image
is selected, so that they won't have to click the Submit button?
From the usability point of view it is a questionable approach: people
are making wrong selection and it is nicer to leave for the them a
chance for the last moment correction. Nevertheless you are the boss.
You may use onchange event handler:
<form method="POST" action="upload. cgi" enctype="multip art/form-data">
* <input type="file" name="file01" onchange="this. form.submit()">
* <noscript><inpu t type="submit" value="Submit"> </noscript>
</form>
Excellent, thank you!
FWIW (and just in case anyone reads this later with the same plan),
the visitor only has one image that they can upload, and it's being
saved on the server as their username; thus, each time they upload a
pic it will rename the existing one to username-backup.jpg, and then
the new one is named username.jpg. This way, I can add a button to
revert back to the original one if they don't like the new one (which
would just delete username.jpg and rename username-backup.jpg to
username.jpg).
Thanks again,
Jason This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: x. zhang |
last post by:
Hi Guys,
We know that we can use <input type=file ...> to upload
one file per time to the server. My question is if there
are some way to upload multiple files per time to the
server. (Of course, we can use <input type=file ...>
multiple times and then submit once. But this is not what
I want, because we have to click "browse" button several
times to select multiple files before submit in this
way.) "Upload multiple files PER TIME", I...
|
by: Amar |
last post by:
I am trying to upload a file to the webserver through my
asp.net application. The file upload works fine for files
below 50 MB size because i have set the maxrequestlength
property of the <httpruntime> in the machine.config file
as 51200KB. whenever the user tries to upload a file which
is more than 51200KB then, a blank page with DNS error is
shown as soon as the user hits the submit button.
I want to be able to display an error message...
|
by: |
last post by:
Thanks Richard and Shan,
I am using the HtmlInputFile control.But Shan where
exactly do you want me to put in your code? becoz,after
the user selects a file to upload and hits Submit, then
the flow of the code does not go into the OnClick() event
of the submit button, if the filesize is > 50 Mb.I checked
this by setting a breakpoint on the first line of the
OnClick event. The aspx page just shows a DNS error page.
Is there a way, that i...
|
by: Bijoy Naick |
last post by:
I've written a simple file upload user control in VB .NET. It comprises of
an InputFile HTML Server Control, an Upload button and a message label.
User clicks on the Browse button of the InputFile control, selects a file,
then clicks on the Upload button. The file is saved to a folder on the
server and the message label displays the appropriate msg. The user control
also has a SetFilePath method.. This is used by the page which includes...
|
by: Raven Jones |
last post by:
Heya all,
I'm working on a web-based application (using ASP.NET and C# on .NET
1.1.4322, supporting only IE6 for Windows) that allows for file uploads.
Screen real estate is at a premium, so I want to set its style to "display:
none;" and interact only with the standard file upload dialog (which can be
summoned by firing the click() method of the control).
Attempting programmatic access of a file upload control is generally playing...
| |
by: markus.rietzler |
last post by:
i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.
my script is based on ajax-uploader, which can be found at
www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple
file uploads. each upload will have it's own "form"-tag, so that each
file is uploaded for its own. could be a good solution if there are
"big" uploads.
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
|
by: GuangXiN |
last post by:
I want the file upload element disappear, instead of it, I place a text
box and a button with my own css defination.
but it doesn't work on IE7. What should I do now?
<form action="upload.php" method="POST" enctype="multipart/form-data">
<p>
<span>Select photo:</span>
<input type="file" name="photo" style="display:none;">
<input type="text" name="photoUrl" class="s1" />
<input type="button" class="s2"...
|
by: vijaykumardahiya |
last post by:
Hello To Every One,
I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic.
I read the FileUpload Home page.But I am still confused.
Is that true that file uploaded image can not show on servlet.Its store to database or memory..??
Please assist me.
Thanks.
|
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...
|
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,...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |