Page 1 of 1

post to php file upload

Posted: Thu Nov 10, 2011 1:35 am
by Steve Denney
Hi, sorry if this is double posting, but I'm becoming increasingly desperate. I can't get livecode's ftp to work so I'm hoping I can mimic a php file upload submit.

Livecode's post works well when the php isn't a file upload i.e. <form action="my_stuff.php" method="post">

But I need it to replace <form action="my_upload_file.php" method="post" enctype="multipart/form-data">

With php submit forms the first method populates the $_post array, the other (the file upload form) creates a $_post and a $_file array.

I'm very new to php.

Has anyone managed a file upload using livecode's post to a custom php page?

Steve

Re: post to php file upload

Posted: Thu Nov 10, 2011 8:45 pm
by Steve Denney
Hi well, evidently livecode's ftp does work after all (so relieved), but I am still interested to hear if anyone's uploaded via php.
Steve

Re: post to php file upload

Posted: Fri Nov 11, 2011 10:23 am
by Mark
Hi Steve,

Just use the regular php syntax to retrieve the files from the client.

Post multipart from data from LiveCode.

Kind regards,

Mark

Re: post to php file upload

Posted: Sat Nov 12, 2011 2:46 am
by Steve Denney
Thanks for replying Mark.

Not quite sure what you mean, but I think it's this:
I use post to send the required info to the submission page where I can retrieve said info from the $_post array and manually set the $_file array?

I probably won't have time to try this for a while but if & when I do I'll report back.

I'm thinking posting to php may have advantages over ftp--with ftp you supply a server password & username, if these were compromised a hacker potentially has access to your site. With a php page you can use a mysql db username & password and the worst that can happen is a hacker can use your php page. (Well, that's a simplification and could even be untrue, but it seems safer to me).

Steve

Re: post to php file upload

Posted: Sat Nov 12, 2011 10:55 am
by Mark
Hi Steve,

Hve you read the PHP example I linked to? It explains it all, except instead of using an HTML form, you use a multi-part POST URL command in LiveCode, with exactly the same variables as in that HTML form.

Kind regards,

Mark