NSURL to NSDATA or Data is always nil
<p>I am trying to upload a video to a server file through Alamofire but I couldn't get the "data" going to be passed..its always nil</p>

<pre><code>    var videoURL = NSURL(string: "")
   //returns Optional(file:///private/var/mobile/Containers/Data/Application/1FB40086-228B-4011-A9D4-7874E2EEF9F4/tmp/4A6AAD76-B899-4B67-8E96-925DA4AE9E93.mov)


    let videodata =  NSData(contentsOfFile: (videoURL?.absoluteString)!)
    //nil  
    let url = NSURL(fileURLWithPath: (videoURL?.absoluteString)!)

    let videodata = NSData(contentsOf: url as URL)
    //nil
</code></pre>

<p>If I get data would lead a way for me to do this:</p>

<pre><code> Alamofire.upload(multipartFormData: { multipartFormData in
                multipartFormData.append (videodata as! Data, withName: "file", fileName: "file.mov", mimeType: "video/quicktime")
enter code here
</code></pre>

<p>EDIT::</p>

<p>thank you guys, with your help I have struggled my way out of there to this file not found error, but I can see the file is being saved in my gallery, any clue would save my day.</p>

<pre><code>      print (videoURL!)
//returns file:///private/var/mobile/Containers/Data/Application/3F280477-DA16-4A67-AE60-D6247143352E/tmp/1E4AC002-6AD0-41E1-9E0D-A09B697F81F7.mov


       print (videoURL!.path!)
      // returns /private/var/mobile/Containers/Data/Application/3F280477-DA16-4A67-AE60-D6247143352E/tmp/1E4AC002-6AD0-41E1-9E0D-A09B697F81F7.mov


        var videoData = NSData()

        let path = videoURL!.path!
        if FileManager.default.fileExists(atPath: path) {

        }else {
               print("Could not fin file at url: \(videoURL!.path!)")
             // here it throws file not found
        }
</code></pre>