on 2016 Jun 08 12:23 PM
With php I can simply write a short snippet to receive an image. Like this:
$uploaddir = 'upload/';
$uploadfile = $uploaddir . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploadfile) )
{
echo "success";
} else
{
echo $uploadfile;
}
So my question is, does anyone know how to get this functionality with a SQLAnywhere webservice? How can I access Http variables like the $_FILES (php)?
I want to send a captured image from an android device to a SQLAnywhere webservice.
Thanks for your help! Regards
Request clarification before answering.
Please see the example called "gallery.sql" that comes with the SQL Anyhere install.
The basic idea is that you can get all of the information that you need from the POST request to the server by using the HTTP_VARIABLE() function.
An excerpt from the gallery.sql example:
declare v_name varchar(250);
declare v_type varchar(50);
declare v_image long binary;
declare i int;
[...snip...]
set v_name = http_variable( 'image', NULL, 'Content-Disposition' );
set v_type = http_variable( 'image', NULL, 'Content-Type' );
set v_image = http_variable( 'image', NULL, '@BINARY' );
[...snip...]
-- pick out the filename from the Content-Disposition
set i = locate( v_name, 'filename=' );
set v_name = substr( v_name, i+10 );
set i = locate( v_name, '"' );
set v_name = left( v_name, i-1 );
The v_name variable contains the file name that was uploaded and v_image contains the actual image content.
The post_data.sql and put_data.sql examples may also be of some help.
HTH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
9 | |
9 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.