mikk809h Posted April 1, 2014 Share Posted April 1, 2014 Hello I am trying to make a basic website with an Lua emulator, which is going to upload a long string(a file), so it can be processed and uploaded to the web... I have the following code: <?php $postdata=$_POST['POSTDATA'] or "WRONGDATA"; $posttype=$_POST['POSTTYPE'] or "WRONGTYPE"; $postname=$_POST['POSTNAME'] or "WRONGNAME"; /*echo $postdata;*/ $currentPath=$_SERVER['PHP_SELF']; $endPath=$currentPath.'/files/' . $posttype . '/' . $postname; move_uploaded_file($postdata, $endPath); /* but this line wont work with postdata... */ ?> I am uploading a long text with the following command line http://mywebsite.com/dev/upload.php?POSTDATA=allfiledata&POSTTYPE=program&POSTNAME=testprogram Any help ie very appreciated! Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/287453-upload-data-to-file-from-a-specified-postthefiledata/ Share on other sites More sharing options...
requinix Posted April 1, 2014 Share Posted April 1, 2014 As long as you're using POST and not the URL like in your example, $_POST['POSTDATA'] is a string. That's it. All you have to do is stick it in a file with something like file_put_contents. Quote Link to comment https://forums.phpfreaks.com/topic/287453-upload-data-to-file-from-a-specified-postthefiledata/#findComment-1474669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.