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'm doing a simple upload from a form that has lots of fields. When I select the local file (and it does exist) I get the error "Local file doesn't exist.". I do check to make sure the destination directory is there and writable before uploading. The form has "enctype="multipart/form-data". Do you have any ideas of what I can do to make this work?Reply
Here is part of my form - if the user chooses to upload their own stationery, "stationery_wrap" div is opened, the file box appears and they select their file from their hard drive. This is the file I want to upload onto the filesystem of my server, and put the filename into a mysql db.
There is nothing in the log file. I did fix one problem - I had a function called process that I renamed. Now the form submits, but the file is not uploaded. I do print out that it finds the $dir_dest directory, but nothing is uploaded to it. It is chmod'd to 777. I am assuming that the $dir_dest is based off the / directoryReply
There must be something in the log. Output $handle->log after calling process()
Looking again at your code, it looks like you have your own custom process() function. In this function, you instantiate the class, but you didn't indicate whether you are calling the class' process() function.
Look again at the code examples in the doc. It should basically look like this:
$handle = new Upload($_FILES['custom_stationery']);
if ($handle->uploaded) $handle->process('/my/dest/dir/');
<input type="radio" value="plain" class="stationery_radio" name="stationery_radio" checked />
<label for="plain" >Plain</label>
<input type="radio" value="easter" class="stationery_radio" name="stationery_radio" />
......
<input type="radio" value="own_stationery" class="stationery_radio" name="stationery_radio">
<label for="own_stationery">Add Your Own</label>
<div id="stationery_wrap">
<label for="custom_stationery">Select File: </label>
<input type="file" id="custom_stationery" value="" name="custom_stationery" />
</div>
All the variables are put in here:
In process, I call the upload:
Also, before you instantiate the class, can you dump the contents of $_FILES?
[custom_stationery] => Array ( [name] => DCP_0168.JPG [type] => image/jpeg [tmp_name] => /var/tmp/php6ElbvB [error] => 0 [size] => 461388 )
Looking again at your code, it looks like you have your own custom process() function. In this function, you instantiate the class, but you didn't indicate whether you are calling the class' process() function.
Look again at the code examples in the doc. It should basically look like this: