My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks. 8 8778
VUNETdotUS wrote:
My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks.
Actually, this is still the only (form-based) method of uploading a file
without the page appearing to reload. You can do some neat tricks with
it though - for example, monitoring the progress of the file upload with
asynchronous requests lets you create nice little progress bars (which
users really like, if they are able to see it - nobody likes waiting for
an upload to finish when they have no idea of when that might be).
Jeremy
On Nov 2, 1:11 pm, Jeremy <jer...@pinacol .comwrote:
VUNETdotUS wrote:
My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks.
Actually, this is still the only (form-based) method of uploading a file
without the page appearing to reload. You can do some neat tricks with
it though - for example, monitoring the progress of the file upload with
asynchronous requests lets you create nice little progress bars (which
users really like, if they are able to see it - nobody likes waiting for
an upload to finish when they have no idea of when that might be).
Jeremy
Thanks! Progress bar is a great idea. I saw some examples before.
Though how do I know the upload status, unless you mean a rotating
image which can be shown and removed after submission?
VUNETdotUS wrote:
Thanks! Progress bar is a great idea. I saw some examples before.
Though how do I know the upload status, unless you mean a rotating
image which can be shown and removed after submission?
You can use an implementation of the IXMLHTTPRequest interface to make
requests to the server and to evaluate the corresponding response message.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
On Nov 2, 4:51 pm, VUNETdotUS <vunet...@gmail .comwrote:
My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks.
If you meant AJAX, then no - you cannot do that. That would require
Javascript
to read local files and get their contents, which will never be
possible, for
security sake. I hope they're going to add such functionality that
would somehow
get these contents through a file input, if it's already filled by the
user.
VUNETdotUS wrote:
My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks.
That is the usual way of uploading without leaving the current page.
See http://extjs.com/ for a library which provides way of doing just that.
If your form with the <input type="file"has the id "file-form", them you'd write
Ext.Ajax.reques t({
form: 'file-form',
url: '/myUpload.do', // Optional if the form has the correct action attribute
params: { // Optional params that are temporarily added as hidden
type: 'jpg'
caption: 'A picture'
},
isUpload: true // Optional if the form has enctype="multip art/form-data"
success: function() {
alert('File uploaded');
},
failure: {
alert('File could not be uploaded');
}
});
On Nov 10, 9:57 pm, TheBagbournes <no...@noway.co mwrote:
If your form with the <input type="file"has the id "file-form", them you'd write
Ext.Ajax.reques t({
form: 'file-form',
url: '/myUpload.do', // Optional if the form has the correct action attribute
params: { // Optional params that are temporarily added as hidden
type: 'jpg'
caption: 'A picture'
},
isUpload: true // Optional if the form has enctype="multip art/form-data"
success: function() {
alert('File uploaded');
},
failure: {
alert('File could not be uploaded');
}
});
So what is this code about? AJAX has nothing to do with the OP's
question, because it cannot submit files from input="file" elements.
This is why for multipart/form-data forms with file upload AJAX never
was an option, one needs to stay with frame/iframe for that.
To OP: the security model of file upload element treats each such
element as one-time only, nontransferable user permission to read and
upload a single file from her hard drive to the server where such
permission explicetly expressed by direct physical user's interaction
(click on Browse..., select file, click OK).
Any deviation from this model you may find on a particular browser is
a serious security hole to be reported rather than to be anyhow used.
Lucky all popular browsers do implement this model very strictly. The
only difference I'm aware of is that IE allows to invoke click()
methods for type="file" to call "Select file" dialog w/o user clicking
Browse... button. FF considers it as a violation of the spelled
security model and I do agree with them (anyone is welcome do not).
VK wrote:
On Nov 10, 9:57 pm, TheBagbournes <no...@noway.co mwrote:
>If your form with the <input type="file"has the id "file-form", them you'd write
Ext.Ajax.reque st({ form: 'file-form', url: '/myUpload.do', // Optional if the form has the correct action attribute params: { // Optional params that are temporarily added as hidden type: 'jpg' caption: 'A picture' }, isUpload: true // Optional if the form has enctype="multip art/form-data" success: function() { alert('File uploaded'); }, failure: { alert('File could not be uploaded'); }
});
So what is this code about? AJAX has nothing to do with the OP's
question, because it cannot submit files from input="file" elements.
This is why for multipart/form-data forms with file upload AJAX never
was an option, one needs to stay with frame/iframe for that.
"AJAX" isn't a thing. It doesn't do anything, it's just an unfortunate buzzword that we have to use.
Anyway, what that code does, is submits the form named in the form property to the URL named in the url property, targetting a hidden IFRAME.
It calls either of the two callbacks when the IFRAME is loaded. The name of the function involves the letters "A", "j", "a" and "x". Don't let that upset you.
On Nov 2, 7:51 am, VUNETdotUS <vunet...@gmail .comwrote:
My goal is to upload files without submitting the form. I am not
looking for the code here but rather a concept. I did a little
research and discovered that I can submit a form to an invisible
dynamically creeated iframe (to avoid page reloading) and the server
page will invoke the client page (where the form is) with
window.parent.f oo function.
However I suspect that this is an old method and I miss some improved
ideas. What can one suggest for my case?
Thanks.
It's an old method. You're right. FileList should be the way to go. I
haven't used this yet. http://www.w3.org/TR/file-upload/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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: 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
|
by: Wayne Smith |
last post by:
I've come up against a major headache that I can't seem to find a solution
for but I'm sure there must be a workaround and I would really be grateful
of any help.
I'm currently building a web site for a small club I belong to and one of
the features I would like to include is the ability to allow users to upload
image files.
unfortunately the servers web root www folder only allows READ and EXECUTE
permissions, which makes it...
|
by: pbd22 |
last post by:
hi.
i am having probs understanding how to grab a file being uploaded from
a remote client. i am using hidden input fields for upload such as:
<input id="my_file_element" type="file" name="file_1" size=46 /><input
type=submit />
so, after adding a few files, the input fields look like this:
| |
by: Newcomsas |
last post by:
Hello.
I'm experiecing a problem with file uploads from ASP pages.
On a Windows 2000 - IIS 5 server we're running an ASP Classic
application that features an upload form for files of great dimensions
(100+MB). Problem is, when we try to upload a file exceeding 3MB we
retive almost immediatly a message such as 'The page cannot be
displayed'.
|
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: dragiton |
last post by:
SA Upload SQL Database variable types (image upload and storage)
I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something.
<form name="UpdatePropertyPicture" method="POST"...
|
by: MoroccoIT |
last post by:
Greetings -
I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to mydirectory, but for some reason, I am getting different file names on the database.
Here is the full code: please do serach on kewword "database" to see where I added my database code - that where I need help with.
And here the link where I got it...
|
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: 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...
|
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...
|
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: 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...
| |