I'm trying to write an upload function that returns the location of the uploaded file. the location will be used in a function that calls the Imagick class to resize the image a few times for use in responsive design. Only problem is...I'm getting nothing from the return statement and can't figure out why. Heeeelp! *before i gouge my eyes out
HERE'S THE CODE*
function imageResize($image){
//call to imagick class and resize functions will go here
echo 'the image to be resized is : '.$image;
}
function file_upload(){
if(!empty( $_FILES) ){
$tmpFldr=$_FILES['upFile']['tmp_name'];
$fileDest='users/uploads/'.$_FILES['upFile']['name'];
if(move_uploaded_file($tmpFldr,$fileDest)){
echo 'Congratulations, your folder was uploaded successfully';
}
else{
echo 'Your file failed to upload<br><br>';
}
return $fileDest;
} else{die( 'Nothing to upload');}
} /*End file upload function */
file_upload();
imageResize($fileDest);
ifstatement, you're better off using a variable to store the result you want to return and return that var at the end of the function.