0

I want to send a file to a server using Javascript on the client end and a perl cgi script on the server. And well I don't know where to start.

This is what I understand that I need to do; open the file read it, pass it to the server as the request body, pull the file out of the request body at the server end.

So any one know a good way to do this? also if I have got any of the basics wrong please let me know.

1

1 Answer 1

1

I'd recommend using jquery client-side and CGI.pm server-side. The following resources will provide details:

  • Tutorial on how to exploit the File API of modern browsers (with or without drag-and-drop metaphor). To see whether or not your targeted user agents support this technique, look here and here.
  • JQuery method to issue a POST request the data attribute will be reader.result in your case (adopting the variable names from the code examples in the linked tutorial). just keep in mind to call reader.readAsText to make the file contents available to javascript.
  • processing uploaded files with the perl module CGI.pm as part of a cgi script.

drop a comment if you need more support to get your job done. the explanations and the sample code in the cited docs are actually pretty good. Also have a look at the answer to the question Quentin ref'ed if you haven't yet done so. regards

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.