'Post'ing a file using JS

J

jagathprakash

Hi all,

I am a novice in javascripting. I am writing a firefox plugin, in which
I have to upload a file as a post request to some website. I also need
to pass a password to the site.

I am using the XMLHttpRequest object to do it, but I could not figure
out how I send the file.
ie. do i do
XMLHttpRequestobject. send('&file=<file_loc>') which I feel is
obviously wrong.


-PJ.
 
E

Erwin Moller

Hi all,

I am a novice in javascripting. I am writing a firefox plugin, in which
I have to upload a file as a post request to some website. I also need
to pass a password to the site.

I am using the XMLHttpRequest object to do it, but I could not figure
out how I send the file.
ie. do i do
XMLHttpRequestobject. send('&file=<file_loc>') which I feel is
obviously wrong.


-PJ.

Hi,

Maybe first read a good introduction:
www.w3schools.com then select AJAX.

Regards,
Erwin Moller
 
J

jagathprakash

Hi Erwin,

I did go through the w3schools tut on ajax but no help there especially
on post requests and none whatsover on how to send a file accross.
I have 'google'ed for this thing and not found much result.

-PJ.
 
E

Erwin Moller

Hi Erwin,

I did go through the w3schools tut on ajax but no help there especially
on post requests and none whatsover on how to send a file accross.
I have 'google'ed for this thing and not found much result.

Hi,

I don't know about developing FF plugins, but maybe this is relevant:
JS will not allow you to select files on the clients machine, and send then
to some server because of obvious security implications.
For a file to get submitted in a form, userinteraction is demanded by (not
broken) browsers, so the user knows excactly what is submitted.

Regards,
Erwin Moller

PS: Don't toppost

Because reading backward is difficult.
Why is that?
Topposting!
What is the most annoying thing on usenet?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top