Im currently working with Jcrop to let users crop an image, after they crop they can upload the image, I want to use php to crop the image and move the file to the correct directory.
This is the tutorial im following: Tutorial
In my i have this input element :
<input type="file" name="upload-image" id="upload-image"/>
then when the image crop region is selected with Jcrop the user will upload the form. this is the bit of PHP which is not working:
// new unique filename
$sTempFileName = 'cache/' . md5(time().rand());
// move uploaded file into cache folder
move_uploaded_file($_FILES['upload-image']['tmp_name'], "upload/" . $sTempFileName);
Then when i upload the form i get these 2 errors.
Warning: move_uploaded_file(../upload/cache/6b769249a48996fd69d527b2412b684e): failed to open stream: No such file or directory
and
Warning: move_uploaded_file(): Unable to move 'C:\wamp1\tmp\phpB1A0.tmp' to '../upload/cache/6b769249a48996fd69d527b2412b684e'
I checked a lot of stackoverflow pages already but the all use a folder to upload the image to, but in this tutorial it says it needs to upload the file into the cache folder. That makes me think i don't need to specify a folder to upload to.