tags:

views:

60

answers:

3

How to make a basic PHP uploader? I want my images to save in my htdocs/myfolder/....
Here is my code:

<form enctype="multipart/form-data" method="post" action="img_uploader.php">
<input type="file" name="fileToUpload" /><br />
<input type="submit" value="Upload File" />
</form>
+2  A: 

I followed this tutorial to make my first php image uploader some time ago:

File Upload Tutorial

Austin Fitzpatrick
+1. Really all you have to do is google.
Josh K
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], "C:/program files/xampp/htdocs/jordan pagaduan/user_images/" . $_FILES["fileToUpload"]["name"]); ..... I have this code... but i want my directory is only /user_images/ ... not including the drives..
Jordan Pagaduan
+1  A: 

There are full examples of how to do this on the PHP website:

http://us3.php.net/manual/en/features.file-upload.post-method.php

You're off to a good start, just look at Example #2 on that page.

Adam Backstrom
A: 

Here is a quick tutorial I found for doing a file upload:

http://www.tizag.com/phpT/fileupload.php

I read through it pretty quick, but it gives you the basic idea with some safety stuff to boot

Patrick