i�A�v����ŋN�������J�����̉摜���T�[�o�ɃA�b�v���[�h���镔���̃R�[�f�B���O�ł��B
�Ƃ����Ă��A�J�����摜���X�N���b�`�p�b�h�ɕۑ����鎞�̎菇�Ɠ����ł��B
�����MJAVA�ɕs����ȈׁA���Q�l���x�ɂ��ĉ������B
���L�R�[�f�B���O�ŁA�T�[�o�ɉ摜�f�[�^�����M����܂��B
�T�[�o���ł̓f�[�^��M�p��CGI���K�v�ɂȂ�܂��B
���L�ł́Aupload.cgi������CGI�ɂȂ�܂��B
---- /* �J�����̋N��&�B�e�͊��ɍς�ł�����̂Ƃ��܂��B �{���ɑ��M���镔���݂̂����Ă��܂��B Camera�I�u�W�F�N�g���́umyCamera�v�ł��B*/ HttpConnection conn = null; OutputStream out = null; InputStream in = null; try { // �J�����摜����̓X�g���[���Ƃ��Ď擾 in = myCamera.getInputStream(0); // �J�����摜�̃o�C�g�����擾 long nLen = myCamera.getImageLength(0); // int�^�ɃL���X�g int w_length = (int)nLen; // �摜�f�[�^���o�C�g�z��ɑ�� byte [] w_data = new byte[w_length]; // �Ăяo��CGI��HTTP��ݒ� String url = new String(getSourceURL()+"../cgi-bin/upload.cgi"); conn = (HttpConnection)Connector.open(url,Connector.READ_WRITE,true); conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); conn.setRequestMethod(HttpConnection.POST); //���M // OutpuStream�ւ̏o�̓X�g���[�����擾 out = conn.openOutputStream(); // InputStream����OutputStream�֏��������o�� while ((w_length = in.read(w_data)) != -1 ) { out.write(w_data,0,w_length); } // �e��ڑ����N���[�Y in.close(); out.close(); // �ڑ� conn.connect(); conn.close(); } catch (Exception e) { try { if (conn !=null) conn.close(); if (in !=null) in.close(); if (out!=null) out.close(); } catch (Exception e2) { } System.out.println("use err:"+e); } ----
���Ȃ݂ɁA�f�[�^����M����CGI�̕��́APerl�ł悯��Ή��L�̃R�[�h�ɂȂ�܂��B
---- #!/usr/bin/perl ## �ݒ� # �摜��ۑ�����f�B���N�g�� # ���̃v���O��������̑��p�X # �Ō��/�ŕ��� $img_dir = "./image/"; # �摜�t�@�C���� $filename = "sample.jpg"; ## �ݒ肱���܂� ## ���C������ &getdata; &imgout; ## �f�[�^�̎�M sub getdata { binmode(STDIN); if ( $ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'} ); } else { $buffer = $ENV{'QUERY_STRING'}; } } ## JPG�摜�̏����o�� sub imgout { open(IMGOUT,">$img_dir$filename"); binmode(IMGOUT); print IMGOUT $buffer; close(IMGOUT); } ----
Copyright©2003 ken. All Rights Reserved.