uploading file into a directory
Posted: Tue Sep 08, 2009 11:39 pm
hi! i'm new in php and I'd like to know what's the correct code for adding a file into a directory. The file is from a form and you have to select a directory in the form where to add it. I used this code:
$uploadDir = '../site/photos/'$_POST['albums']'';
if(isset($_POST['submit']))
{
$fileName = $_FILES['image1']['name'];
$tmpName = $_FILES['image1']['tmp_name'];
$fileSize = $_FILES['image1']['size'];
$fileType = $_FILES['image1']['type'];
$filePath = $uploadDir.$fileName;
$result = move_uploaded_file($tmpName, $filePath);
but it's not working.
Thanks!
$uploadDir = '../site/photos/'$_POST['albums']'';
if(isset($_POST['submit']))
{
$fileName = $_FILES['image1']['name'];
$tmpName = $_FILES['image1']['tmp_name'];
$fileSize = $_FILES['image1']['size'];
$fileType = $_FILES['image1']['type'];
$filePath = $uploadDir.$fileName;
$result = move_uploaded_file($tmpName, $filePath);
but it's not working.
Thanks!