urlrequest

Failing to Upload Picture with multipart/form-data to a Server

这一生的挚爱 提交于 2019-12-08 16:11:30
I've read quite a lot of topics here on multipart/form-data . It still doesn't work. I am able to upload a file to my server with URLSession.shared.uploadTask . class MainViewController: UIViewController { @IBOutlet weak var pictureView: UIImageView! @IBAction func postTapped(_ sender: UIButton) { postData() } func postData() { var request = URLRequest(url: URL(string: "http://www.mywebsite.com/upload.php")!) request.httpMethod = "POST" request.timeoutInterval = 30.0 guard let imageData = UIImagePNGRepresentation(pictureView.image!) else { print("oops") return } let uuid = UUID().uuidString

Send POST request with custom headers using flash

十年热恋 提交于 2019-12-08 08:22:25
I am trying to send POST request with custom headers using flash, but I can only get it to send the request as GET even when I use request.method = URLRequestMethod.POST; Here is my code: package { import flash.display.Sprite; import flash.events.*; import flash.net.*; public class URLRequestExample extends Sprite { private var loader:URLLoader; public function URLRequestExample() { loader = new URLLoader(); configureListeners(loader); var url:String = "http://example.com/"; var headers:Array = [ new URLRequestHeader("X-CUSTOM-HEADER", "X-VALUE"), new URLRequestHeader("Accept", "application

ActionScript Get All Network Activity?

ⅰ亾dé卋堺 提交于 2019-12-08 07:32:47
问题 Is there a way within ActionScript 3.0 to: Get all URLRequests() that are made within the application? Get all RTMP:// connections to a Flash Media server? Since my application contains SWC files which were compiled by another developer, I cannot directly access the ActionScript which creates the URL requests and RTMP connections. Thank your for your time. 回答1: You can use a web debugging proxy to monitor all messages that are sent over the wire. I like to use Charles because it deserializes

Send POST request with custom headers using flash

心不动则不痛 提交于 2019-12-08 07:16:46
问题 I am trying to send POST request with custom headers using flash, but I can only get it to send the request as GET even when I use request.method = URLRequestMethod.POST; Here is my code: package { import flash.display.Sprite; import flash.events.*; import flash.net.*; public class URLRequestExample extends Sprite { private var loader:URLLoader; public function URLRequestExample() { loader = new URLLoader(); configureListeners(loader); var url:String = "http://example.com/"; var headers:Array

How to play a sound in Actionscript 3 that is not in the same directory as the SWF?

こ雲淡風輕ζ 提交于 2019-12-07 11:45:37
问题 I have a project with a bunch of external sounds to a SWF. I want to play them, but any time I attempt load a new URL into the sound object it fails with either, Error #2068: Invalid Sound or raises an ioError with Error #2032 Stream Error // Tried with path prefixed with "http://.." "file://.." "//.." and "..") var path:String = "http://../assets/the_song.mp3"; var url:URLRequest = new URLRequest( path ); var sound:Sound = new Sound(); sound.addEventListener( IOErrorEvent.IO_ERROR,

How to play a sound in Actionscript 3 that is not in the same directory as the SWF?

前提是你 提交于 2019-12-05 22:04:44
I have a project with a bunch of external sounds to a SWF. I want to play them, but any time I attempt load a new URL into the sound object it fails with either, Error #2068: Invalid Sound or raises an ioError with Error #2032 Stream Error // Tried with path prefixed with "http://.." "file://.." "//.." and "..") var path:String = "http://../assets/the_song.mp3"; var url:URLRequest = new URLRequest( path ); var sound:Sound = new Sound(); sound.addEventListener( IOErrorEvent.IO_ERROR, ioErrorHandler); sound.addEventListener( SecurityErrorEvent.SECURITY_ERROR, secHandler); sound.load(url); Well,

When POSTing a form with URLRequest, how to include cookies from browser session?

做~自己de王妃 提交于 2019-12-04 10:38:07
(With reference to this answer :) When I POST with a URLRequest, does it automatically include cookies from the browser session in which Flash is hosted? If not, how can I make it include them, or if necessary retrieve them and include them myself? Provided the cookie domains (of the page hosting the Flash control and the URL to which you're posting) match, then yes, the browser cookies get sent with the request by default. As a quick example ( working version here ), I've thrown together a simple ColdFusion page hosting a SWF containing the following code: <mx:Script> <![CDATA[ private

Unexpected Flash Security Exception When Using URLLoader

℡╲_俬逩灬. 提交于 2019-11-29 10:47:06
What I am trying to accomplish is to upload some binary data, specifically a ByteArray representing a PNG image, to a server using the URLLoader class in conjunction with URLRequest. When I set the contentType property of the URLRequest to 'multipart/form-data' instead of the default, the call to urlLoader.load() results in a security exception. When I leave the contentType property as the default, it works fine, but takes a long time (proportional to the length of the PNG file) to upload the file to the server. So, my question is WHY am I getting this security exception? And how can I avoid

Flex 3 - how to support HTTP Authentication URLRequest?

谁说胖子不能爱 提交于 2019-11-27 00:45:15
I have a Flex file upload script that uses URLRequest to upload files to a server. I want to add support for http authentication (password protected directories on the server), but I don't know how to implement this - I assume I need to extend the class somehow, but on how to I'm a little lost. I tried to modify the following (replacing HTTPService with URLRequest), but that didn't work. private function authAndSend(service:HTTPService):void{ var encoder:Base64Encoder = new Base64Encoder(); encoder.encode("someusername:somepassword"); service.headers = {Authorization:"Basic " + encoder

What is the most robust way to force a UIView to redraw?

蓝咒 提交于 2019-11-26 15:46:38
I have a UITableView with a list of items. Selecting an item pushes a viewController that then proceeds to do the following. from method viewDidLoad I fire off a URLRequest for data that is required by on of my subviews - a UIView subclass with drawRect overridden. When the data arrives from the cloud I start building my view hierarchy. the subclass in question gets passed the data and it's drawRect method now has everything it needs to render. But. Because I don't call drawRect explicitly - Cocoa-Touch handles that - I have no way of informing Cocoa-Touch that I really, really want this