Upload data to file from a specified post='thefiledata'

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Thu May 16, 2013 5:45 am

Upload data to file from a specified post='thefiledata'

Postby mikk809h » Tue Apr 01, 2014 11:03 am


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:

Code: Select all

  $postdata=$_POST['POSTDATA'] or "WRONGDATA";
  $posttype=$_POST['POSTTYPE'] or "WRONGTYPE";
  $postname=$_POST['POSTNAME'] or "WRONGNAME";
  /*echo $postdata;*/
  $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

Code: Select all


Any help ie very appreciated!

Thanks in Advance

php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Upload data to file from a specified post='thefiledata'

Postby seandisanti » Wed Apr 02, 2014 1:18 am

http://us3.php.net/manual/en/function.m ... d-file.php That page gives example of uploading multiple files and then moving them around. You should be very careful with what you're making, that's an idea that opens a lot of attack vectors to your web server. Whenever someone has the ability to arbitrarily execute code or get your server to parse arbitrary files, you increase the odds of privilege escalation attacks, injection attacks, etc. It's never a bad idea in those situations to serve the file from a virtual machine that has no rights to other resources on the computer or network. Just something to think about.

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 7 guests