Go Down

Topic: [ASK] Arduino yun upload data into webserver (Read 972 times) previous topic - next topic

albertgeez

Hi all,

I am new in arduino yun, I have a question, it is possible to upload data into webserver using arduino yun without wifi shield? Thanks before

Robin2

The Yun includes WiFi so there is no need to add a shield.

It also has an Ethernet connector if you don't want to use WiFi - your question is ambiguous.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

albertgeez

hmmmm so it is possible to use only yun to send the data. do you have the tutorial about this one? Thanks before

sonnyyu

#3
Jun 23, 2015, 05:08 pm Last Edit: Jun 23, 2015, 05:21 pm by sonnyyu
Code: [Select]
curl -i -F name=test -F filedata=@/mnt/sda1/localfile.jpg http://example.org/upload.php

Code: [Select]
nano /mnt/sda1/upload.sh

Code: [Select]
#!/bin/ash
curl -i -F name=test -F filedata=@/mnt/sda1/localfile.jpg http://example.org/upload.php


Code: [Select]
chmod  755  /mnt/sda1/upload.sh

"upload.php" code:

Code: [Select]

<?php
// Example of accessing data for a newly uploaded file
$fileName basename($_FILES["filedata"]["name"]); 
$fileTmpLoc $_FILES["filedata"]["tmp_name"];
// Path and file name
$pathAndName "/home/uploads/".$fileName;
// Run the move_uploaded_file() function here
$moveResult move_uploaded_file($fileTmpLoc$pathAndName);
// Evaluate the value returned from the function if needed
if ($moveResult == true) {
    echo 
"File has been moved from " $fileTmpLoc " to" $pathAndName;
} else {
     echo 
"ERROR: File not moved correctly";
}
?>





sonnyyu

ATmega32u4 Code:

Code: [Select]
#include <Process.h>
void setup() {
  Bridge.begin();   // Initialize the Bridge
  uploadfiles();
}
void loop() { }
void uploadfiles() {
  Process p;
  p.runShellCommand("/mnt/sda1/upload.sh");
  while (p.running());
}

jessemonroy650

#5
Jun 23, 2015, 11:55 pm Last Edit: Jun 23, 2015, 11:56 pm by jessemonroy650
CANNED ANSWER

= [Q:] How do I send data to an internet web server? =

If you want just Linux side, there are solution that people have documented.

google: arduino yun curl python

Good Articles:
* Understanding Arduino Yún's bridge
* Securing communications with HTTPS on the Arduino Yun


Of course, you can use python, lua, ash (shell), and CURL

Is this enough? Or are you looking for more?

Jesse

Go Up