class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I am using a very small file from my PC for just that reason.
I've got the enctype set on my form.
My variable $fileToUpload is $fileToUpload = $this->message_vars['fileName'];, which is correct as I've printed this out to my error log. Could it be that fileToUpload is not found because it is the name of a local file on my filesystem, but $fileToUpload does not contain a path?Reply
But you need to instantiate the class with an upload field, that is an value from the array $_FILES. In your code, it seems that your upload file (input type="file") doesn't have a name. It should, and then you use this name to find the correct value in the $_FILES array.
Look at the code sample in the class itself, it is a minimal example showing how to create a form and instantiate the class. In your case, your form fields are incomplete, and cannot work.Reply
Also make sure that you set the enctype property of your form tag, as following: enctype="multipart/form-data"
And what do you have in your variable $fileToUpload?
I've got the enctype set on my form.
My variable $fileToUpload is $fileToUpload = $this->message_vars['fileName'];, which is correct as I've printed this out to my error log. Could it be that fileToUpload is not found because it is the name of a local file on my filesystem, but $fileToUpload does not contain a path?
But you need to instantiate the class with an upload field, that is an value from the array $_FILES. In your code, it seems that your upload file (input type="file") doesn't have a name. It should, and then you use this name to find the correct value in the $_FILES array.
Look at the code sample in the class itself, it is a minimal example showing how to create a form and instantiate the class. In your case, your form fields are incomplete, and cannot work.
$handle = new Upload($_FILES['attachment']);
Works great now. Thanks so much for the quick responses!