it exist ... on my computer monitor...
and can play...ㅠㅠ
Sending POST request to web server
log> phpoc_spi: resync spi channel...success
log> phpoc_begin: shield package version 1.0.1
log> phpoc_begin: WiFi INFRA s-lab2 ch11
log> phpoc_begin: IPv4 192.168.120.46 255.255.255.0 192.168.120.1 203.248.252.2
initialization failed!
initialization done.
disconnected
log> phpoc_dns: query A 192.168.120.23 >> 192.168.120.23
log> phpoc_client: connect 2 >> success
initialization failed!
initialization done.
error opening test.wav
#include <SPI.h>
#include <Phpoc.h>
#include <pcmConfig.h>
#include <pcmRF.h>
#include <SD.h>
#include <TMRpcm.h>
#include <SPI.h>
#define SD_ChipSelectPin 53
char server_name[] = "192.168.120.23";
TMRpcm audio;
File myFile;
PhpocClient client;
void setup() {
Serial.begin(9600);
while(!Serial)
;
Serial.println("Sending POST request to web server");
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
SD.begin(SD_ChipSelectPin);
audio.CSPin = SD_ChipSelectPin;
if (!SD.begin(4)) {
Serial.println("initialization failed!");
}
Serial.println("initialization done.");
}
void loop() {
if(client.available())
{
char c = client.read();
Serial.print(c);
}
if(!client.connected())
{
Serial.println("disconnected");
client.stop();
delay(5000); // wait 5 seconds
if(client.connect(server_name, 80))
{
if (!SD.begin(4)) {
Serial.println("initialization failed!");
}
Serial.println("initialization done.");
if (SD.exists("TESTT.WAV")) {
Serial.println("testt.wav is existed") ;
}
myFile = SD.open("testt.wav",FILE_WRITE);
if (!myFile) {
// if the file didn't open, print an error and stop
Serial.println("error opening test.wav");
while (true);
}
uint16_t wavlen = myFile.size();
Serial.println(wavlen);
uint16_t extra_length;
String start_request = "";
String end_request = "";
start_request = start_request +
"\n--AaB03x\n" +
"Content-Disposition: form-data; name="userfile"; filename="testt.wav"\n" +
"Content-Transfer-Encoding: binary\n\n";
end_request = end_request + "\n--AaB03x--\n";
extra_length = start_request.length() + end_request.length();
Serial.println("Extra length:");
Serial.println(extra_length);
uint16_t len = wavlen + extra_length;
uint16_t full_length;
full_length = start_request.length() + len + end_request.length();
myFile.read();
Serial.write(myFile);
Serial.println("done2");
client.println("POST /examp1.php HTTP/1.1");
client.println("Host: ");
client.println("Content-Type: multipart/form-data; boundary=AaB03x");
client.print("Content-Length: ");
client.println(full_length);
client.print(start_request);
client.write(myFile);
static const size_t bufferSize = 1024;
static uint8_t buffer[bufferSize] = {0xFF};
while (len) {
size_t will_copy = (len < bufferSize) ? len : bufferSize;
SPI.transfer(&buffer[0], will_copy);
if (!client.connected()) break;
client.write(&buffer[0], will_copy);
len -= will_copy; }
client.println(end_request);
}}}
file size is 1000000