Upload and Save an Image in the Server
Try to implement following code 

function myid_user_page_form(){ 
$form = array();
$form['myphoto'] = array(
  '#type' =&gt; 'managed_file',
  '#title' =&gt; 'File Upload',
  '#upload_validators' =&gt; array('file_validate_extensions' =&gt; array('png gif jpg jpeg')),
  '#upload_location' =&gt; 'public://my-folder/'
   );

$form['submit'] = array(
 '#type' =&gt; 'submit',
 '#value' =&gt; 'Save',
 '#attributes' =&gt; array('id' =&gt; 'myid_save'),
 '#submit' =&gt; array('formsave_action'), 
 );  
 return $form;
}





function formsave_action($form,&amp;$form_state) { 
    $file = file_load($form_state['values']['myphoto']);
    $file-&gt;status = FILE_STATUS_PERMANENT;
    file_save($file);
}