Search code examples
phpsaving-data

php saving file to a specific location


I am a bit of a dummy when it comes to php. I was wondering how to save a file uploaded to a php script (using POST) to a specific location. So for example i want to save it in the directory www.mysite.co.nz/data/motelname/

Also the android sends pairs of data, so how would i make that data into a file with the first bit of data the file name and the second the .txt file data.

If there are any tutorials on this please comment the here too thanks.


Solution

  • check out these:

    http://www.htmlgoodies.com/beyond/php/article.php/3472551/PHP-Tutorial-Uploading-Files.htm

    http://www.sitepoint.com/handle-file-uploads-php/

    you can move the uploaded file to every folder that has 777-rights (do it with "chmod 777 foldername" on the shell) via

    move_uploaded_file($tmp_name, "my_directory/$filename");