help on php

  • gu3
  • Proficient
  • Proficient
  • User avatar
  • Posts: 322
  • Loc: NCL- England

Post 3+ Months Ago

can any help me finish off my php upload page, i have made one but it just uploads anything and to the main area on the server. i need it to only upload to a certain folder and only let it upload pictures, can anyone help?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Anaster
  • Novice
  • Novice
  • User avatar
  • Posts: 24

Post 3+ Months Ago

Here is a simple example:

Here is the form:
Code: [ Select ]
<form method="POST" action="upload.php" enctype="multipart/form-data">
<input type=\"file\" name=\"user_file\">
</form>
  1. <form method="POST" action="upload.php" enctype="multipart/form-data">
  2. <input type=\"file\" name=\"user_file\">
  3. </form>


Here is a very simplified php code for upload.php
PHP Code: [ Select ]
 
$file = $_FILES['user_file']['tmp_name'];
 
$upload_dir = $_SERVER['DOCUMENT_ROOT']."/my_pics/";
 
copy ($file,$upload_dir."uploaded_pic.jpg");
 
 
  1.  
  2. $file = $_FILES['user_file']['tmp_name'];
  3.  
  4. $upload_dir = $_SERVER['DOCUMENT_ROOT']."/my_pics/";
  5.  
  6. copy ($file,$upload_dir."uploaded_pic.jpg");
  7.  
  8.  


And that's all you need to do a simple upload of files using php.

good luck
  • gu3
  • Proficient
  • Proficient
  • User avatar
  • Posts: 322
  • Loc: NCL- England

Post 3+ Months Ago

thank you very much. iv been searching the internet alot for that xD

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.