How to replace servlet doPost method with PHP or Python or Perl? -



How to replace servlet doPost method with PHP or Python or Perl? -

i uploading image file on server using javascript , servlet. servlet dopost method follows.

protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub system.out.println( " image sent server "); servletinputstream servletinputstream = request.getinputstream(); file capturefile = new file("./images/img1.jpg"); system.out.println(capturefile.getabsolutepath()); if(!capturefile.exists()) { capturefile.createnewfile(); } fileoutputstream fileoutputstream = new fileoutputstream(capturefile); int c; while((c = servletinputstream.read()) != -1) { fileoutputstream.write((char)c); //system.out.print((char)c); } fileoutputstream.close(); }

in javascript creating header , body follows:

header = 'post /file/upload http/1.1\r\n'; body += '[[[binary_image]]]\r\n'; body += '\r\r';

now want replace servlet code php. not understanding how in php or python. can guide me on this? python or perl replacement work me.

php python servlets post http-post

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -