Reputation: 35
so i have build a 3 step form, on step 1 there is a upload file input at the end of step one when the step one is validated i call:
$_SESSION['img']=array();
$_SESSION['img']['tmp_name']=$_FILES['file']['tmp_name'];
$_SESSION['img']['name']=$_FILES['file']['name'];
_crop("data/", $_SESSION['img']['tmp_name'], $_SESSION['img']['name'] , 83, 83);
with _crop
being the function that resize my image, so here everything works the img is uploaded to the data/ dir and resize, but if i call the function _crop at the third step of my form the img wont be uploaded even if
$_SESSION['img']['tmp_name']=$_FILES['file']['tmp_name'];
$_SESSION['img']['name']=$_FILES['file']['name'];
are still visible on step 3 of the form.
Upvotes: 1
Views: 192
Reputation: 6094
Uploaded files are temporary, and deleted just after request is completed, you should move temporary file to some directory, using move_uploaded_file() function.
Upvotes: 1
Reputation: 493
Read Carefully: http://php.net/manual/ru/function.move-uploaded-file.php
File is moved, not copied from the temporary directory
Upvotes: 0