-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Upload issue on PHP Handler (Swift 3 / XCode 8) #45
Comments
Does your server work with other kinds of uploads, with curl, for example? Does it receive the request despite the file missing? Daniel Duan
|
Yes. As explained above, it works on other HTTP Client libraries. Basically the code uses POST, so i was thinking if this is a file upload, isnt this supposed to be PUT? |
@aguel from a technical point of view, there's no different between POST and PUT. But modern conventions give them different semantic meanings. Can you post |
Not an issue at all. I missed one parameter in the data section causing the problem. |
Im currently on XCode 8 with Swift 3 and i have a PHP file upload handler in the server side. Using the provided playground file, and basically just changing the POST URL to my PHP handler, upload doesnt work (file not reaching the server) but no error whatsoever. Fyi, i used another swift HTTP client (Swift 2.x version compatible) with the same PHP handler and it is working fine.
From playground:
let elonPhotoURL = Bundle.main.url(forResource: "elon", withExtension: "jpg")! let uploadResult = Just.post("**http://xxxx.com/uploader.php**", files:["elon": .url(elonPhotoURL, "image/jpeg")]) // <== that's it print(uploadResult.text ?? "")
Not sure if this log info will help?
"iSignature[10575:3106978] bool _WebTryThreadLock(bool), 0x7960e950: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now..."
The text was updated successfully, but these errors were encountered: