473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Asynchronous File Upload

Frinavale
9,735 Expert Mod 8TB
I'm attempting to upload a file asynchronously to the server by using an IFrame.

I have an Asp.NET FileUpload control on the page (which renders as an <input type="file> HTML element) and a submit button along with an IFrame.

I am attempting to redirect the form's target into the IFrame.

I have the following JavaScript function which should redirect the form's action into an Iframe on the page:
Expand|Select|Wrap|Line Numbers
  1. function redirectFormAction(iframeTargetID) {
  2.     var theForm = document.forms['theFormsID'];
  3.     theForm.target = iframeTargetID;
  4. }
This method is called on the button's onclick event:
Expand|Select|Wrap|Line Numbers
  1. <input id="fup" type="file" style="width: 222px;" name="fup"/>
  2. <input id="upload" type="submit" style="width: 222px;" onclick="ChangeHasOccurred(); AllowPostback('xyz'); redirectFormAction('ctl00_theiframe');" value="Preview" name="upload"/>
  3. <iframe id="ctl00_theiframe" src="#" name="ctl00_theiframe">
  4. </iframe>
The page form is still submitting in the window (not the iframe)...what am I doing wrong?

-Frinny
Sep 16 '09 #1
2 3936
acoder
16,027 Expert Mod 8TB
See the code for this. Should give some ideas.
Sep 16 '09 #2
Frinavale
9,735 Expert Mod 8TB
I'm actually using that article (along with a few others) as a reference right now.

I didn't want to create an Object that is going to do something during the form's onsubmit either (because it should just happen when the button's clicked).

And instead of dynamically creating the iframe I've just added it to the page to keep things simple...

I didn't really see the point of creating an Object to do all of that when I could keep things much simpler..

However, I haven't tried "f.setAttribute('target', name);"
[edit]
The setAttribute() method did not make any difference.
It still isn't working, the page is still isn't being submitted using the iframe.
[/edit]
Sep 16 '09 #3

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

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
0
by: Simple Simon | last post by:
Hi, excuse the long post and plz read on :) My web application needs to upload a .csv & .zip file, as well as, import the .csv into a (Sql2000) table and unzip the .zip file to a directory on...
0
by: Simple Simon | last post by:
Hi, I'm having a little trouble with the architecture of my Web App. Bascially, I need to import some MLS data into a SQL Db from (3) comma-delimited files, as well as, upload and extract the...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: RJN | last post by:
Hi I have 2 operations to perform one is to upload data and the second is to generate report. Both take huge time(more than 20 mins and I believe by that time session would have expired) and...
2
by: Marco Assandri | last post by:
Hi, I saw some web sites where I can upload file asynchronously. May I do the same think with asp.net?
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
7
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"...
6
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.