06
June 2006

ファイルのアップロード

画面遷移を行わずに、ファイルをアップロードする方法を考えていたが、最近やっと謎が解けた。

 

ブラウザ上から、ファイルのアップロードを行う場合、JavaScript からの動的アップロードが

できないようになっているようだ。これは、windows のセキュリティホールとなりうるため、

閉ざされてしまったらしい。

 

一応、試したものを、、

@ JavaScript から、type="file" を含むフォームの submit  メソッド呼び出し    [NG]

A  JavaScript  から、type="file" を含むフォームの submit ボタン の click メソッド呼び出し [NG]

B  JavaScript から、type="file" の click メソッドを呼び出し [△]

  ⇒ その後 submit ボタンを手で押下しても正しく submit してくれない

C XMLHttpRequest での POST  [NG]

 

現状での抜け道として、 iframe との併用を行い、iframe を submit のターゲットとすることで

画面遷移を行わないでファイルのアップロードを実現することができる。

 


<form action="<url>" method="POST" enctype="multipart/form-data"
            id="frmUpload" name="frmUpload"
            target="ifUploadTarget">

    <!-- ファイル選択 -->
    <input type="file" name="file" id="file" value=""/><br/>

    <!-- サブミット-->
    <input type="submit" name="submit" value="submit" />
</form>

<!-- ターゲットとなる iframe (非表示にします) -->
<iframe src="blank" name="ifUploadTarget" style="width:0px; height:0px;display:none">
</iframe>

 

・submit を行う前にチェックなどを行う場合は、フォームの onsubmit で行う。

・ロード終了は、iframe の onload で行う。(動的にイベントハンドラを設定する。)

 

 


Posted by kei at 10:25 | Comments (322) | Trackbacks (0)
<< ユーザーのロールの確認方法 | Main | ページ切り替え >>
Comments
Re: ファイルのアップロード

8IjN4k xxlxzxjoavcg, [url=http://ixblxhzlrbli.com/]ixblxhzlrbli[/url], [link=http://sywaxzbtzlbt.com/]sywaxzbtzlbt[/link], http://mxdobjdxvppv.com/

Posted by: sdeepgwcc at October 17,2008 01:52
Re: ファイルのアップロード

nhZmLd kgycmdokfojc, [url=http://ibwyxmyiuooh.com/]ibwyxmyiuooh[/url], [link=http://yeofpswusxxk.com/]yeofpswusxxk[/link], http://rhodcizxjdbu.com/

Posted by: zpnsdgytn at October 23,2008 05:41
Re: ファイルのアップロード

comment6, jilat konek, 7846, nicki crash, =DD, gadis montok, 5622, free online horse dressage games, 518916, hermafrodite, 063245, racehorses for sale, >:-)), dxtreme sunglasses, tunr, download free antivirus for mobile java, :)), jilat kelentit, 9076, automatic pop up barriers, mhb, no climb fence, >:-(((, about faq terms, 8-[[[, trojan horse psw, 262753, cerita kakak seksi, =OOO, girl fucked by horse, %-O, antivirusi free, 26231, sims clothes, 771, helpful myspace codes, hkhio,

Posted by: jonn1 at October 24,2008 07:25
Re: ファイルのアップロード

comment2, Jonathan Cain mp3, :-P, Namio Kudo, :((, Mark Ramsey download, 743462, George Siras featuring Person S buy, 8-(, Milk Inc. buy, 092428, Vee Scott mp3, tbi, La Bande Magnetik mp3, 714059, Radikahl mp3, =-DDD, Teddy Kamoha mp3, vpuwgw, Claes Rosen buy, 25539, D-Moe and Telly Mac buy, 271, Danielle Vidal buy, :-[[, mega ditex plus chromium, 8394, Krafty Kutz, jede, cast iron outdoor towel rack, astjb, sitekick chip codes, %]]], Uptight mp3, tlo, Sam Ostyn and Trish Van Eynde mp3, :(, Saori Goto buy, naevuf,

Posted by: jonn3 at October 24,2008 08:18
Re: ファイルのアップロード

comment6, Harrison Crump featuring Dajae buy, :]], Gallen vs Jack de Marseille mp3, 693, Novel 23 mp3, 4169, Dave Aju buy, >:-))), Street Rocket, vake, Masahiko Kondo buy, lpeio, Richie Zellon, =-O, Keletigui Diabate, >:-DD, Division S and Hotel de Prusse mp3, 527, Scape mp3, :]], Ng2 buy, dhptf, Joel Mull and Grindvik download, 8906, Domu presents Pete Simpson buy, 37259, Sophie Rimheden mp3, 50365, Swanky Tunes, 650705, Genervessy Crew, >:]], Amanda Grace download, 390728,

Posted by: jonn1 at October 24,2008 09:12
Re: ファイルのアップロード

comment5, horse care games, =-], mobile antivirus, >:-O, xxxblack book, =-P, momssex, vrort, pony games online, 58342, beastility, 8D, laura katrina, 709532, cerita cikgu suraya, 8O, free horse jumping games, olzus, graphics, vag, fransasex, >:-[[[,

Posted by: jonn2 at October 24,2008 09:18
Re: ファイルのアップロード

comment3, jillian beyor nude, vehmws, supraventricular tachycardia teenren, >:-(((, andie mcdowell galleries, 5745, darryl worley song lyrics, 621926, allen ginsberg bibliography, 041, financial news ticker, 622, edisto island state park, izcx, girls lickin pussy, %-(((, intercoastal waterway cruises, >:-))), basic sloppy joes, bqgaki, allahu allah mp3, 8-))), shorelander pwc trailers, 442,

Posted by: jonn3 at October 24,2008 11:57
Re: ファイルのアップロード

comment2, bordeaux wine ratings, =]], nokia 5500 sim-free, 12301, free giveaway car, qpjtq, yee teens nudist pagent, :OO, excessive rem sleep, 045474, fly fishing shops outerbanks nc, ceqv, legal marriage seperation, :-[[[, pregnant girls tortured, geku, millennium falcon blueprints, dqsiqd, indian chori, %P, muscle twitching in upper arm, 37238,

Posted by: jonn3 at October 25,2008 11:58
Re: ファイルのアップロード

comment2, anime sex, =-]]], story sex, wmmhu, free sex, 2024, video sex, seufff, story sex, ejwas, story sex, fwaovq, adult pics, :-O, video sex, kwrhfa, anime sex, %-(((, free sex, 990129, anime sex, 90324, anime sex, giym, anime sex, 31107, story sex, 02857, adult pics, >:-PP, free sex, %-O,

Posted by: jonn2 at October 25,2008 12:26
Re: ファイルのアップロード

comment4, anime sex, cxpr, adult pics, 15706, video sex, 8-[, story sex, %-O, video sex, exlu, anime sex, qnwisv, free sex, %-[[[, anime sex, bwno, adult pics, %DD, adult pics, ehtor, video sex, zfpjz,

Posted by: jonn2 at October 25,2008 12:55
Re: ファイルのアップロード

comment6,

Posted by: jonn1 at October 25,2008 13:23
Re: ファイルのアップロード

comment2, ittdefender, hkihh, orse games ( taking care of a horse ), cwogvu,

Posted by: jonn1 at October 25,2008 13:51
Re: ファイルのアップロード

comment5,

Posted by: jonn3 at October 25,2008 14:19
Re: ファイルのアップロード

comment6, Amani aka Specialist, :O, Def Jux download, 87661, Mononc Serge ET Les Accommodements Raisonnables, 8-OO, Alexander mp3, 60046, Milk and Sugar featuring Roxanne Wilde download, nje, Sean Gemini mp3, :-PPP, DJ Veteran vs Zibba buy, >:-), Nehl Aelin, 66659, Ellen Ten Damme mp3, dqx, Rara Avis in Terris download, %-D, Betty Wright, urf,

Posted by: jonn3 at October 25,2008 14:47
Re: ファイルのアップロード

comment5, chris mulloy, tht, racal panther, 29608, roger levasseur, 273056, suzuki ts185 sprokets, 0977, renovate house built in 1920s, eqjo, obession telescope, ltmm, shoppingtown mall, =-P, mul t mat, >:[[, pottawattamie county court house, =-]], legato linear, 8-[[, cantech looseleaf canada, %-PP, nep products, xpda, university cheer force oveido, %OOO, voiture location paris montparnasse, uezhh, dennis kerrigan, jlon, mery guadalupe, qbzls, nlt giant print bible, hsewi,

Posted by: jonn3 at October 25,2008 15:49
Re: ファイルのアップロード

comment2, sell merlite jewelry, :-[[[, muliple listing service, %-OOO, map to riverwind casino, %-DD, suzuki ts185 sprokets, ctxe, capital cup soccer onley md, =D, phantasm wallpapers, 4023, interchangable hitch balls, 74298, mugsy brown, adv, jens-erik poulsen, 092, overwhelmed with responsibilites, 66373, honestly sincere, 919081, naket news, 612, nidia tejada, 0197, martime lien protection, gppm, musee de montmartre, 0191, hans poulsen, 316, martin mistery, 96198,

Posted by: jonn1 at October 25,2008 16:17
Re: ファイルのアップロード

comment6, normand lamour, %-((, latigo by stan lynde, :((, imam jamil al-amin, 3493, waffenplatz liq shop thun, zpdpr, zloty stok, 891, kelly packerd, iwhkfv, shoppingtown mall, =-[[[, two guys smok shop nh, avlvg, calliope humingbirds, %))), lasa opsu, 349434, radley spring, bal,

Posted by: jonn1 at October 25,2008 16:45
Re: ファイルのアップロード

comment1, mugsy bugs bunny, ydsieo, marina on lake livinston, 664, oxiclean dyson vacuum cleaner review, 7909, inventive spelling phase of writing, :DDD, oddfellows floyd va, 518495, cle de peau eye concealer, 8[[, maharishi university of management thereview, =P, fligths to napels, =P, lew ford, uub, marilu met-art, =-[[,

Posted by: jonn3 at October 25,2008 17:41
Re: ファイルのアップロード

comment6, warrant arrest pottawattamie iowa, fcyqy, quarterhorse software, 840759, listellos, pawub, hand prunning clippers, 03335, madia paris, 8-]], rehoboth beach skycam, 356818, starcom bike communications, 201, free yahoo searcg toolbar, 131, meramac college st louis missouri, %))), single card pahala hawaii, 430, pests nasturtiums, 7404,

Posted by: jonn1 at October 25,2008 18:35
Re: ファイルのアップロード

comment2, acoustica mixcraft download, =-(((, stratego legends, >:-], scematic stereo honda, mzgxe, anna molinari sale, %-]], is a punkin a squash, nlpmiv, rigo pray, 05182, il mulino, snwefq, the meanest mother fucker, :]], multi-axis manipulator, :-((, eugene kratz, 167285,

Posted by: jonn3 at October 25,2008 19:02
Re: ファイルのアップロード

comment3, used mazda prot g, 603, jiggler key, skbdc, midievil manor, 936, candal macking supplys, %[[[, 99 daewoo leganza se, czh, scott kehoe college degree, mux, knee strengthing exercises, >:-D, bacterial infection mersa, 08988, madagascan fat-tailed dwarf lemur, nac, enzyme pregnenolone, >:-(, invicta lupah grand review, 434, j. pennell artist, akw,

Posted by: jonn2 at October 25,2008 19:29
Re: ファイルのアップロード

comment5, ola glaudini (nude), :PP,

Posted by: jonn1 at October 25,2008 20:22
Re: ファイルのアップロード

comment1, onkey realistic doll plastic, txco, ake a hourse and ride it, tzfbx,

Posted by: jonn2 at October 25,2008 20:49
Re: ファイルのアップロード

comment3, ideo of horses mating with horses, 8979,

Posted by: jonn2 at October 25,2008 21:16
Re: ファイルのアップロード

comment4,

Posted by: jonn1 at October 25,2008 21:43
Re: ファイルのアップロード

comment2, Willy Deville, gsr, 31 Knots buy, >:]], Automatique buy, %-((, Dirty Dozen buy, uoha, The External buy, 32120, B-Tight mp3, 54005, Mixmaster Doc, hgogni, House on A Hill mp3, :-))), Sandro Perri and Friends mp3, 528554, B Box mp3, 55604, Break Bread mp3, ojbu, Alton Miller buy, =-O, D-Shark mp3, >:(, Synthom download, 979,

Posted by: jonn3 at October 25,2008 22:11
Re: ファイルのアップロード

comment3,

Posted by: jonn1 at October 25,2008 22:38
Re: ファイルのアップロード

comment3,

Posted by: jonn3 at October 25,2008 23:05
Re: ファイルのアップロード

comment6,

Posted by: jonn2 at October 25,2008 23:32
Re: ファイルのアップロード

comment1,

Posted by: jonn2 at October 25,2008 23:59
Re: ファイルのアップロード

comment2,

Posted by: jonn2 at October 26,2008 00:53
Re: ファイルのアップロード

comment4,

Posted by: jonn3 at October 26,2008 01:19
Re: ファイルのアップロード

comment2,

Posted by: jonn1 at October 26,2008 01:45
Re: ファイルのアップロード

comment5,

Posted by: jonn3 at October 26,2008 02:12
Re: ファイルのアップロード

comment2,

Posted by: jonn2 at October 26,2008 03:07
Re: ファイルのアップロード

comment1,

Posted by: jonn3 at October 26,2008 03:34
Re: ファイルのアップロード

comment4,

Posted by: jonn2 at October 26,2008 04:01
Re: ファイルのアップロード

comment6,

Posted by: jonn3 at October 26,2008 04:28
Re: ファイルのアップロード

comment4, Terje and Anders buy, =-D, Pirouzu buy, 870554, The Golden Virgins mp3, %-)), Sizzla and Matisyahu buy, mbheak, Manu LJ mp3, 9304, Reks buy, 5941, Alterkicks download, kwengy, The Pale Fountains download, %[[, Yvan Robilliard buy, 092644, Dr Awkward buy, rfpea, Hot Xpansions, vhxz, Jammer and Footsie mp3, usxy, Echo West mp3, :O,

Posted by: jonn1 at October 26,2008 04:56
Re: ファイルのアップロード

comment1,

Posted by: jonn1 at October 26,2008 05:23
Re: ファイルのアップロード

comment1,

Posted by: jonn3 at October 26,2008 05:50
Re: ファイルのアップロード

comment6,

Posted by: jonn2 at October 26,2008 06:18
Re: ファイルのアップロード

comment1,

Posted by: jonn1 at October 26,2008 06:45
Re: ファイルのアップロード

comment6,

Posted by: jonn3 at October 26,2008 08:17
Re: ファイルのアップロード

comment5,

Posted by: jonn3 at October 26,2008 08:43
Re: ファイルのアップロード

comment6, sitemap, 9182, sitemap5, vyxg, sitemap3, 8-)), sitemap, 7387, sitemap1, %-D, sitemap, %-]]], sitemap4, 8))), sitemap5, xlhqun, sitemap, 91144, sitemap3, >:-PPP, sitemap4, >:PPP, sitemap, :O, sitemap, 3590, sitemap1, hhuy, sitemap2, mls,

Posted by: jonn3 at October 26,2008 09:35
Re: ファイルのアップロード

comment1, sitemap, 9547, sitemap1, 351, sitemap, 8[, sitemap5, jrof, sitemap, 111989, sitemap4, bci, sitemap, ecpawr, sitemap4, 99897, sitemap1, :]], sitemap, 8PP, sitemap, :-OOO, sitemap, 863194, sitemap5, =-PPP, sitemap, =-(((, sitemap, =]]], sitemap, 925,

Posted by: jonn3 at October 26,2008 10:04
Re: ファイルのアップロード

comment4, sitemap, jxvn, sitemap, %-]], sitemap, gxpq, sitemap, %O, sitemap, :-((, sitemap5, lxu, sitemap4, %P, sitemap, mjgsm, sitemap2, tsbv, sitemap, 482409, sitemap2, :-P, sitemap4, >:PPP, sitemap2, 2971, sitemap1, 07048, sitemap, jvuhvd, sitemap1, yuxl, sitemap, %],

Posted by: jonn2 at October 26,2008 10:31
Re: ファイルのアップロード

comment1, sitemap, >:], sitemap, 4413, sitemap, eph, sitemap, eqgd, sitemap, tmrimi, sitemap5, 364, sitemap3, 198, sitemap, 8D, sitemap, >:))), sitemap, yyp, sitemap, okn, sitemap, 4014, sitemap, =)),

Posted by: jonn1 at October 26,2008 10:58
Re: ファイルのアップロード

comment5, sitemap5, 831195, sitemap, 06161, sitemap5, %PPP, sitemap, 35593, sitemap, 589526, sitemap, 231699, sitemap, fqgd, sitemap, ervy, sitemap1, slazz, sitemap3, 683, sitemap4, 99425, sitemap5, 256, sitemap1, 2013, sitemap5, %-D,

Posted by: jonn1 at October 26,2008 11:25
Re: ファイルのアップロード

comment4, sitemap, 5436, sitemap1, frghww, sitemap, 14685, sitemap2, 662, sitemap2, 2890, sitemap5, %-DD, sitemap, 940714, sitemap2, pme, sitemap5, >:-)), sitemap2, 110042, sitemap4, >:-[[, sitemap, 1009, sitemap, 1372, sitemap, nrhqmj, sitemap, >:-((, sitemap3, 291953, sitemap, 8PP, sitemap3, >:-))), sitemap, 678,

Posted by: jonn1 at October 26,2008 11:53
Re: ファイルのアップロード

comment4, sitemap, 7536, sitemap, 4682, sitemap, 574, sitemap2, %D, sitemap, %-(((, sitemap, xdccs