Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Http Text and image

edited September 2014 in Questions Posts: 27

Hey guys,
I just want to make a project, where you can write a text or upload an image. These text should be uploadable, so everyone can get these text on his device, if he call the correct "http function". So I need a code, what upload the text you write to the internet ( "http" ) and another code what get the code from the internet ("http") and shows it.
But I don't know how I could do this, because I'm very new here.
Can somebody help me? With answers or code.
That would be very nice.
Thank you very much.


  • IgnatzIgnatz Mod
    Posts: 5,396

    @hallomio77 - hi there, welcome. Where are you from?

    To upload text to the internet, you need a web server that is set up to listen for that text, and put it in a database. Then the same web server can download it to Codea.

    There are websites that will let you set this up for free, but you need to know how to write the code (eg in PHP or JavaScript) to do it. Perhaps someone here can help.

    When you have the web server ready, then Codea can talk to it.

  • edited September 2014 Posts: 282

    @hallomio77 — I'm not sure how this works, but take a look:

    Downloading is fairly simple, http.request will then return a string, the source code of the page, or if is a link to a text file, it will return the text. If the link is an image, it returns an image and not a string.

    Uploading requires server side programming, and I really don't know how to do that, but in the code in the above link, downloading and uploading is shown. The code may be more complex than required, though.

  • dave1707dave1707 Mod
    edited September 2014 Posts: 9,731

    @hallomio77 Here's an example of getting an image from the internet. Getting text is just as easy.

    displayMode(FULLSCREEN) function setup() getImg() end function draw() background(40, 40, 50) if img==nil then fill(255) text("Loading image",WIDTH/2,HEIGHT/2) else sprite(img,WIDTH/2,HEIGHT/2,700) end end function getImg() http.request(' Rican Frog.jpg',gotImage) end function gotImage(image,status,header) img=image end
  • IgnatzIgnatz Mod
    Posts: 5,396

    The problem isn't with Codea, it's with setting up a web server to manage the text submissions

  • Thank you very much for all your comments.
    Did anybody know, which code I need, for example, If I have a server, how I can upload the image or the text there with a code in codea, so someone can upload their image or text on the server and an other people with another App can download and look at them?
    Did anybody know a good tutorial for that, or is this tutorial just in codea?
    Thank you very much

  • dave1707dave1707 Mod
    edited September 2014 Posts: 9,731

    @hallomio77 In my code above, the text "Costa Rican Frog.jpg" should be "Costa%20Rican%20Frog.jpg" . For some reason the "%20" for the space doesn't show. Copying the code and running it causes an error without the "%20" .

  • edited September 2014 Posts: 1,976

    @hallomio77 I'm pretty sure it requires some server-side programming (in a different language, such as PHP). @Prynok is teaching me how to do it, when he's done I could make a summary of how to set it up (there's a lot of stuff so far).

Sign In or Register to comment.