Does anyone have a basic network.upload() example for uploading an image to a web server and the appropriate server side php to go along with it? It’s not very clear how network.upload works or how it should be used according to the docs and a brief tutorial on some of the common uses of network.upload and network.request would be very helpful to many of us it seems.
Hi
I am lookijng for it also
Hi,
Also would like to see this…
Cheers
I’m sorry, I hate to sound like a jerk, but does nobody have a good example of this in Corona? Surely the people developing the SDK have tested these features and can provide an example? Or do I have to spend $2500 a year on an enterprise membership just to have a simple question answered?
.
Hi Anthony,
Sorry I can’t answer your question directly, but in the means time I suggest you check out this link on how to upload a binary, it will get you going in the mean time while we wait for some better examples of how network.upload works.
Craig
We are looking into providing an example for how to do this.
Thanks Rob, please let me know when you guys have something available. The network side of things is a lot more tricky to work with, as you probably know, since you can’t see the direct result of your code (like you can with graphics) and hence more confusing.
Hi
I am lookijng for it also
Hi,
Also would like to see this…
Cheers
I’m sorry, I hate to sound like a jerk, but does nobody have a good example of this in Corona? Surely the people developing the SDK have tested these features and can provide an example? Or do I have to spend $2500 a year on an enterprise membership just to have a simple question answered?
.
Hi Anthony,
Sorry I can’t answer your question directly, but in the means time I suggest you check out this link on how to upload a binary, it will get you going in the mean time while we wait for some better examples of how network.upload works.
Craig
We are looking into providing an example for how to do this.
Thanks Rob, please let me know when you guys have something available. The network side of things is a lot more tricky to work with, as you probably know, since you can’t see the direct result of your code (like you can with graphics) and hence more confusing.
Any news on this?
Any news on this?
need help with this
Let me try to summarize.
If you do not know server side programming, and you just want network.upload() to magically upload data to an arbitrary web server, then network.upload() isn’t going to do what you expect and it never will.
There are too many different ways that a server side programmer could program their upload service that we could never ever have a chance of hitting the needs of your service’s unique methods. There just are no standards there. There are standards on now to talk to a web server, which our network.* API calls do immaculately.
It’s your responsibility to either understand web server-side programming well enough that you can make them talk together, or if you’re using someone else’s server, for them to tell you explicitly what data and headers you need to send and in what format. We just can’t predict that. I’m 100% confident with the changes that Networking 2.0 brought in, that you should be able to get network.request() to upload files to most any web server if you know what the expectations are. We just can’t guess what those expectations will be.
Now that said, there are some PHP methods of uploading files that don’t take a ton of experience to make work. The problem is, the most common one, something that uses the “multipart/form-encoded” method does not work with network.upload(). It works great with network.request(). The network.upload() is a simple helper method for network.request() to try and simplify the call a bit. There is a method using HTTP PUT and on the PHP side, reading the data from STDIN (the file: “php://input”) that network.upload() will work with. Most of the PHP scripts out there need some help figuring out where to save the data too, how to pick up the filename, and you have to know if you’re base64 encoding the data or not.
Where this is left with Engineering is that it would be nice if network.upload() would work with multipart/form-encoded form methodology (like I said, network.request() works today). That will take engineering time to make happen and we want to happen at some point. Because you can make this work today using network.request(), and the Engineering schedule is quite full, it’s unlikely to get time in the near future.
Uploading files isn’t trivial. I wish it were. If this is something your app needs and you’re in control of your own web services, I would recommend learning more about network/web service programming, perhaps in PHP and proceed that way. If you’re wanting to use a service you are not in control in, you need to contact that service and ask them exactly what they need for you to upload a file (HTTP headers and body content and if the data needs to be encoded) and proceed for there.
If you don’t know anything about computer programming but are using a user-friendly hosting service like GoDaddy or something, I might’ve found a solution for you. I personally am way too stupid to figure out that MultipartForm stuff.