//In screen-shot widget, we package the raw data and upload it to server as below by Javascript var xhr2 = new XMLHttpRequest(); xhr2.open('POST', [XXXXXXXX remote server], true); xhr2.onload = function(e) { if (this.status == 200) { } }; var formData = new FormData(); formData.append("screen-shot", blob, getDate().toString() + ".jpg"); xhr2.send(formData); ---------------------------------------------------------------------------------------------------- //This part is how the widget upload the data to server. It uses the standard html form method to upload the data.
------------------------------------------------------------------------------------------------------- //This part is the server end coding for receiving the data and save as a image file. //This sample code is using php language. //There is ome thing need to pay eatra attention on it. //*****Please make sure to use 'screen-shot' to read the file on server side because it corresponds to the html code ''. '; if (file_exists('uploadfiles/', $_FILES['screen-shot']['name'])) { echo $_FILES['screen-shot']['name'] . ' already exists '; } else { if (is_uploaded_file($_FILES['screen-shot']['tmp_name'])) { $stored_path = ROOT.'/uploadfiles/'.basename($_FILES['screen-shot']['name']); echo 'is uploaded file' . ''; if(move_uploaded_file($_FILES['screen-shot']['tmp_name'], $stored_path)){ echo "Stored in: " . $stored_path; }else{ echo 'Stored failed:file save error'; } } } echo '
';
echo 'Here is some more debugging info:';
print_r($_FILES);

print "
"; ?>