[Gambas-user] Post data and files
Szenográdi Norbert
sevoir75 at ...626...
Fri Jul 30 09:12:50 CEST 2010
Hi Jose,
I had same problem yesterday.
My solving:
with installed curl
test.php:
<?php
//variables
// $_POST['thing1'];
// $_POST['thing2'];
// you can use 2 variables for mysql or any other stuff
//file
$target_path = "upload/"; //relative target dir on server
$target_path = $target_path . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['file']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
Gambas2 code example:
2 textbox (txtBox1.text => thing1; txtBox2.text => thing2)
1 textbox for file link (fileBox.text => file)
FMain.class:
PUBLIC SUB Button1_Click()
DIM comm AS String
comm = "curl "
comm &= " -F " & Chr(34) & "file=@" & fileBox.text & Chr(34)
comm &= " -F " & Chr(34) & "thing1=" & txtBox1.text & Chr(34)
comm &= " -F " & Chr(34) & "thing2=" & txtBox2.text & Chr(34)
comm &= " http://www.yourhost.xy/test.php"
shell (comm)
End
///
Best Regards, Sevoir
2010. 07. 29, csütörtök keltezéssel 18.25-kor jose ezt írta:
> Hello people of the forum prawns:
> I have problems trying to send variables from one form to a PHP file
> hosted on a remote server.
>
> Currently I have installed Gambas 2.20, I have sought information about
> it but most of the documentation is limited.
>
> My remote server using PHP 5, there is some documentation.
>
> Unfortunately my native language is Spanish, so my communication is
> limited.
>
> Regards
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list