Retrieve File Url from Upload Form When Form is submitted I have the following code in my form.

function video_subtitles_menu() {
    //print "video_subtitles_menu 1";exit;
  $items = array();
  $items['video_subtitles_test/upload'] = array( //this creates a URL that will call this form at "examples/form-example"
    'title' =&gt; 'Upload Subtitle', //page title
    'description' =&gt; 'Uploading subtitle for videos',
    'page callback' =&gt; 'drupal_get_form', //this is the function that will be called when the page is accessed.  for a form, use drupal_get_form
    'page arguments' =&gt; array('video_upload_subtitles_form'), //put the name of the form here
    'access callback' =&gt; TRUE
  );
      //print "video_subtitles_menu 2";exit;
  return $items;
}




function video_upload_subtitles_form($form, &amp;$form_state) {
 $form = array('#attributes' =&gt; array('enctype' =&gt; 'multipart/form-data'));
 $form['video_name'] = array(
    '#title' =&gt; t('Name Of the video'),
    '#type' =&gt; 'textfield',
 );

 $form['sub_file'] = array(
        '#type' =&gt; 'file',
        '#title' =&gt; t('Upload video'),
        '#size' =&gt; 48,
        '#description' =&gt; t('Pick a video file to upload.'),
    );
 $form['submit_button'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),


    );
 return $form;

}




function video_upload_subtitles_form_validate() {
  if(!file_check_upload('upload')) {
    // If you want to require it, you'll want to do it here... something like this:
    form_set_error('upload', 'File missing for upload.');
  }
}




function video_upload_subtitles_form_submit($form, &amp;$form_state) {
 $video_name = $form_state['values']['video_name'];//I am able to get this 
 $file = file_save_upload('sub_file', array());
print "&lt;pre&gt;";print_r($file);// no response here 
drupal_set_message(t('The form has been submitted.'));//this also not printing 
}


On the submission handler, it only returns the text field, I don`t get anything from file upload field, when I use file_save_upload.

This is the response which i get in firebug, I have tried uploading text and excel file.


What I am trying to do is create a block where you can upload a file than I need to get the url to upload it to CDN but how to get the link of file at form submission. 

I am using Drupal 7 by the way.
found the solution here.I am not sure what is the core issue but below is the solution

This was the comment in the above link where I found solution.


  More than likely eveyone who is having a problem here has been
  developing on their local computer, then are tryng to migrate their
  system to a remote server. When you do this, you are probably moving
  your setting for directory paths along as well.
  
  For example the temp path for your images is probably different than
  the image temp path on your host system.
  
  I recommend this test in Drupal 6.14. goto /admin/settings/file-system
  
  and look at your temporary directory... if its glaring red, then try
  renaming it to something like: /tmp. if that does not work, try
  renaming to just tmp ( no forward slash)
  
  Next step to test this will be to upload an image or file. I tested it
  by uploading a new logo. But remember, that if you do a FULL DB dump
  from phpmyadmin from your local computer to the new host, you will
  probably see this problem again.


For Drupal 7 guys I just went to admin/config/media/file-system , so basically find out where the file system is in your config area and I change the '/tmp' to 'tmp'.

After changing it was able to print the file object :) 

stdClass Object ( [uid] =&gt; 1 [status] =&gt; 0 [filename] =&gt; 3-26-2014 12-15-54 PM.png [uri] =&gt; temporary://3-26-2014 12-15-54 PM.png [filemime] =&gt; image/png [filesize] =&gt; 30536 [source] =&gt; private_file [destination] =&gt; temporary://3-26-2014 12-15-54 PM.png [timestamp] =&gt; 1395828492 [type] =&gt; image [field_replacement] =&gt; stdClass Object ( [uid] =&gt; 1 [status] =&gt; 0 [filename] =&gt; 3-26-2014 12-15-54 PM.png [uri] =&gt; temporary://3-26-2014 12-15-54 PM.png [filemime] =&gt; image/png [filesize] =&gt; 30536 [source] =&gt; private_file [destination] =&gt; temporary://3-26-2014 12-15-54 PM.png [timestamp] =&gt; 1395828492 [type] =&gt; image ) [fid] =&gt; 3102 ) 


Hope it help someone.