[OpenLayers-Users] Problem to send kml file to server,
using OpenLayers.Request.POST
Christopher Schmidt
crschmidt at metacarta.com
Tue Jul 7 10:45:19 EDT 2009
On Tue, Jul 07, 2009 at 12:17:32PM +0200, Vidal, Antoni wrote:
> Hello,
>
>
>
> I read the documentation of use of requesting remote data, and I've followed the examples but I'm not able to send data from an input file field form to a php, and then get the response.
>
>
>
> My goal is let the user to upload a kml file from a form in a OL client, and then read the file and render it in the same OL.
There is no way, in Javascript, to access the value of a file-on-disk
from the browser. You will need to trigger an actual form submission (as
you know how to do). You may wish to trigger the form submission in a
hidden iframe, and then read the response from that iframe , which would
allow your server to receive the file without a page reload.
-- Chris
>
>
> My code:
>
>
>
> function ImportVectorData(){
>
> //document.importkmlform.submit(); THIS WORKS
>
>
>
> var request = OpenLayers.Request.POST({
>
> url: "/php/putKML.php",
>
> data: document.importkmlform.datafile.value,
>
> headers: {
>
> "Content-Type": "multipart/form-data"
>
> },
>
> callback: handler
>
> })
>
> }
>
>
>
> Any help will be appreciate.
>
>
>
> Thank's in advance.
>
>
>
> Antoni Vidal
>
> Unitat d'Aplicacions SIG-WEB
> Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392>
> Parc de Montjuïc, E-08038 Barcelona
> Tel. (+34) 93 567 15 00 (ext. 3228)
> www.icc.cat <http://www.icc.cat/>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list