Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16424
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: javascript to php in the same page |
| Date | 2016-02-15 13:51 +0100 |
| Message-ID | <56C1C9E0.5040408@arnowelzel.de> (permalink) |
| References | <n9pph5$1qss$1@gioia.aioe.org> <87r3gf48b7.fsf@bsb.me.uk> <n9q7f5$gg7$1@gioia.aioe.org> |
alex schrieb am 2016-02-14 um 16:45:
> <html>
> <body>
> Select a file to upload:
> <input type="file" id="myFile" onchange="myFunction()" size="50" >
> <p id="demo"></p>
> <script>
> function myFunction() {
> var vx = document.getElementById("myFile").value;
> document.getElementById("demo").innerHTML = vx;
> }
> </script>
> </body>
> </html>
>
>
> with the code above I can select a file in my pc and can have its name
> inner the variable vx;
Why is "myFile" not sufficient?
> I need have(to pass) this value (file's name), inner a php variable.
This is already done by the <input type="file"> element! You don't need
*any* JavaScript at all to handle file uploads in PHP.
See here as an example:
<http://www.w3schools.com/php/php_file_upload.asp>
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
javascript to php in the same page alex <alex@nomailno.it> - 2016-02-14 12:48 +0100
Re: javascript to php in the same page Tim Streater <timstreater@greenbee.net> - 2016-02-14 12:12 +0000
Re: javascript to php in the same page Luuk <luuk@invalid.lan> - 2016-02-14 15:00 +0100
Re: javascript to php in the same page Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-02-14 15:31 +0000
Re: javascript to php in the same page alex <alex@nomailno.it> - 2016-02-14 16:45 +0100
Re: javascript to php in the same page Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-02-14 11:08 -0500
Re: javascript to php in the same page Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-02-14 16:43 +0000
Re: javascript to php in the same page Luuk <luuk@invalid.lan> - 2016-02-14 17:50 +0100
Re: javascript to php in the same page "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-02-14 18:17 +0100
Re: javascript to php in the same page Luuk <luuk@invalid.lan> - 2016-02-14 19:42 +0100
Re: javascript to php in the same page Tim Streater <timstreater@greenbee.net> - 2016-02-14 19:21 +0000
Re: javascript to php in the same page Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-02-14 21:40 +0000
Re: javascript to php in the same page Erwin Moller <erwinmollerusenet@xs4all.nl> - 2016-02-15 14:49 +0100
Re: javascript to php in the same page Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-02-15 19:20 +0000
Re: javascript to php in the same page Arno Welzel <usenet@arnowelzel.de> - 2016-02-15 13:51 +0100
Re: javascript to php in the same page praider650@gmail.com - 2016-08-17 03:23 -0700
csiph-web