post to php file upload

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

post to php file upload

Post by Steve Denney » Thu Nov 10, 2011 1:35 am

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

Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

Re: post to php file upload

Post by Steve Denney » Thu Nov 10, 2011 8:45 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: post to php file upload

Post by Mark » Fri Nov 11, 2011 10:23 am

Hi Steve,

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

Post multipart from data from LiveCode.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

Re: post to php file upload

Post by Steve Denney » Sat Nov 12, 2011 2:46 am

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: post to php file upload

Post by Mark » Sat Nov 12, 2011 10:55 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply