Local file doesn't exist error

See all posts See thread Reply

Re: Local file doesn't exist error new!
by colin, 11 years, 6 months ago
Why do you select local files with an upload form? How do you instantiate the class? Can you also copy here the log produced by the class?Reply
Re: Local file doesn't exist error new!
by Kathy, 11 years, 6 months ago
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.

<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:
foreach ($_POST as $field => $value)	
$this->message_vars[$field] = parent::secure($value);
$this->process();
In process, I call the upload:
$custom_stationery = ($_FILES['custom_stationery']);
$handle = new Upload($_FILES['custom_stationery']);
Reply
Re: Local file doesn't exist error new!
by colin, 11 years, 6 months ago
Can you copy here the log produced by the class?

Also, before you instantiate the class, can you dump the contents of $_FILES?Reply
Re: Local file doesn't exist error new!
by Kathy, 11 years, 6 months ago
Here is _FILES:
[custom_stationery] => Array ( [name] => DCP_0168.JPG [type] => image/jpeg [tmp_name] => /var/tmp/php6ElbvB [error] => 0 [size] => 461388 )Reply
Re: Local file doesn't exist error new!
by colin, 11 years, 6 months ago
Can you please copy here the log produced by the class?Reply
Re: Local file doesn't exist error new!
by Kathy, 11 years, 6 months ago
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
Re: Local file doesn't exist error new!
by colin, 11 years, 6 months ago
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/');
Reply