IPhone : Swift - How can I upload video file to PHP script using POST method?

on Sunday, April 19, 2015

The video file data is of type NSData and I would like to be able to post it to the PHP server. I know how to typical parameters like strings, integers, base64 encoded strings, etc. I'm just unsure of how to POST the video data. I would like the Swift code to be able to mimic the following HTML:



<!DOCTYPE html>
<head>
<title></title>
</head>
<body>
<form action="videoupload.php" method="post" enctype="multipart/form-data">
<label for="file"><span>Filename:</span></label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>


I already have the PHP code working on the server. Can anyone tell me how I can achieve the same result as the HTML posted above, but by using Swift for iOS? Thanks in advance.


0 comments:

Post a Comment