Jump to content

Upload photo class problem, can not send data


Rommeo

Recommended Posts

I have a simple form to send the photo file to "upload.php"

<form action="upload.php" method="post" enctype="multipart/form-data">
   <input type="file" name="uploaded_image" />
   <input type="submit" name="submit" value="Upload" />
</form>

And I have a upload.php file

include "uploadclass.php";
$image = new image();
$image->url = $_FILES['uploaded_image']['tmp_name'];
$image->upload();

and my image class :

class image
{
public $url;
public $directory ="photos";

public function __set($name,$value) {
$this->$name = $value;
}
public function upload() {
    $file_ext = strrchr($this->url, '.');   // For Instance, .jpg, .gif or .php
    $copy = copy($this->url, "$this->directory" . $this->url); // this line has problem I think
}
}

the last line was working like this :

$copy = copy($_FILES['imagefile']['tmp_name'], "$directory" . $_FILES['imagefile']['name']);

 

But since I m passing it like a variable, I dont know how can I deal with the option "tmp_name" and "name". So this script does not work, how can I send all the variables that the file have ?

 

Thank you in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.